1

When I run following R code in a Windows 7 system, result and plot of kde function of spatialEco library is produced without any issues; as it can be observed in below image.

library(spatialEco)
library(sp)
library(rgdal)
points <- readOGR('points.shp')
mask<- readOGR('mask.shp')
bbox<- bbox(mask)
extent<- c(bbox[1], bbox[3], bbox[2], bbox[4])
raster <- sp.kde(x = points, y = points$newpeligro, newdata=extent, bw=1, n = 5000, scale.factor = 100)
plot(raster)
points(points, pch=20, col="red")
plot(mask, add=TRUE)

enter image description here

However, same code ran in Linux or Windows 10 systems produces for below line:

raster <- sp.kde(x = points, y = points$newpeligro, newdata=extent, bw=1, n = 5000, scale.factor = 100)

following error message:

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘resample’ for signature ‘"RasterLayer", "numeric"’

In this answer:

https://stackoverflow.com/questions/36943201/what-does-this-mean-unable-to-find-an-inherited-method-for-function-a-for-sig/53124958#53124958

it is suggested that it can be due as result of namespace conflicts.

So, I tried out:

raster <- spatialEco::sp.kde(x = points, y = points$newpeligro, newdata=extent, bw=1, n = 5000, scale.factor = 100)

but the problem still persists. Can this issue be solved?

0
1

Oops, found a bug with the extent not being coerced to the correct object class. Just posted a new version of the function in the development version. You can install it using: remotes::install_github("jeffreyevans/spatialEco")

No clear idea on why it is working on Windows 7, as the package version should be the same and this is, in fact, a bug. Perhaps you have an older version of R running under Windows 7 that is using an older package version before this bug was introduced

4
  • I have same version of R in both Windows systems. However, Seven is a 32 bits system and Windows 10 is 64 bits; same as in Debian Linux. I supposed that it could be a bug and you corroborated it. Now, it works like a charm.
    – xunilk
    Oct 24 '19 at 7:47
  • Today, I installed your library from github repository in other two PCs and there was a new error: argument 5 matches multiple formal arguments. I re installed actual version of library and, as result, I got older and initial problem. I'm afraid it is a new bug. Could you review it again? Thanks.
    – xunilk
    Oct 27 '19 at 0:54
  • @xunilk have you read the help for the function? Accessing development version can be trying because one thing is that happens is that function enhancements are often added before being finalized and pushed to CRAN. You should always check to make sure that nothing has changed in a functions usage. In this case, I removed the n argument and replaced it with nr and nc so that a user can define both dimensions of the raster rather than n/2xn/2. As such, you need to define these two arguments and not use n. You can just define nc=2500, nr=2500 for the same results as n=5000. Oct 27 '19 at 1:09
  • Sorry, but I only read the help for the current version because I'm normally working in my 32 bits machine (without any problem with actual version); not for development version. Thanks for your advice.
    – xunilk
    Oct 27 '19 at 1:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.