ropensci / NLMR

📦 R package to simulate neutral landscape models 🏔
https://ropensci.github.io/NLMR/
65 stars 17 forks source link

plot() doesn't work anymore #71

Closed koenraadvanmeerbeek closed 3 years ago

koenraadvanmeerbeek commented 3 years ago

If i just use the code of the vignette to plot a virtual landscape, I get an error. eg: x <- NLMR::nlm_random(20,20) plot(x)

Error in as.double(y) : cannot coerce type 'S4' to vector of type 'double'

marcosci commented 3 years ago

Hi there! You either have to load raster or the NLMR package with library() first. Does this fix your issue?

koenraadvanmeerbeek commented 3 years ago

NLMR was of course loaded, otherwise the first function wouldn't work. But I didn't load the raster package (I thought it would load with NLMR). Now I loaded raster in addition to NLMR and it worked. Thx!

marcosci commented 3 years ago

Actually, it doesn't have to be loaded, since you used :: which just needs the package to be installed - not loaded. But happy that loading the raster package helped!