Note that there are some explanatory texts on larger screens.

plurals
  1. PONamespace issue with raster package plot function?
    primarykey
    data
    text
    <p>I have experiencing a weird problem with the 'plot' function of the 'raster' package. </p> <pre><code>library(raster) ras &lt;- raster(ncol=10, nrow=10) </code></pre> <p>EDIT</p> <pre><code>values(ras) &lt;- runif(ncell(ras)) </code></pre> <p>END EDIT</p> <pre><code>plot(ras) Erreur dans as.double(y) : cannot coerce type 'S4' to vector of type 'double' </code></pre> <p>For what I have read on the net, this error depends on the user, and probably depends on the loaded packages. In my case, the problem comes from the fact that r uses the standard 'plot' method from the 'graphics' package, when it should use the specific 'raster' method since 'ras' is a rasterLayer object. However, for a reason I do not understand, 'plot' is not imported in the 'raster' namespace, while all the other functions are. </p> <pre><code>&gt; raster::plot Erreur : 'plot' n'est pas un objet exporté depuis 'namespace:raster' </code></pre> <p>To be compared with : </p> <pre><code>raster::persp standardGeneric for "persp" defined from package "graphics" function (x, ...) standardGeneric("persp") &lt;environment: 0x0cd9eb80&gt; Methods may be defined for arguments: x Use showMethods("persp") for currently available ones. </code></pre> <p>Since I do not completely understand how namespaces behave, I am looking for your help ! Is this kind of situation familiar for you, and do you have a way to solve it ? In the meantime, do you know a function to display the content of a namespace (so I could check the content of the raster namespace step by step) ?</p> <p>PS: I am using R 2.15.2 with RStudio, many packages loaded but all are up to date.</p> <pre><code>sessionInfo() R version 2.15.0 (2012-03-30) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=French_Belgium.1252 LC_CTYPE=French_Belgium.1252 LC_MONETARY=French_Belgium.1252 LC_NUMERIC=C [5] LC_TIME=French_Belgium.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] raster_2.0-41 sp_1.0-5 loaded via a namespace (and not attached): [1] grid_2.15.0 hexbin_1.26.0 intervals_0.13.3 lattice_0.20-6 rgdal_0.8-4 spacetime_1.0-3 spam_0.29-2 tools_2.15.0 [9] xts_0.9-2 zoo_1.7-9 </code></pre> <p>Thanks you,</p> <p>François</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload