[R-sig-Geo] raster package

Céline Bellard bellard.celine at gmail.com
Tue Sep 4 21:26:57 CEST 2012


Hello,

As you see in my example, I can't use plot function from raster library. 
First thing is that it seems that plot function hasn't the priority over 
the plot function from graphics package. But even if I use explicitly 
the plot function from raster package, it don't work. Have you any 
suggestion ?

> library(raster)
> r=raster()
> values(r)=runif(ncell(r))
> r
class       : RasterLayer
dimensions  : 180, 360, 64800  (nrow, ncol, ncell)
resolution  : 1, 1  (x, y)
extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84
data source : in memory
names       : layer
values      : 4.09456e-06, 0.9999978  (min, max)

> plot(r)
Erreur dans as.double(y) :
cannot coerce type 'S4' to vector of type 'double'
> detach("package:raster")
> plot(r)
Erreur dans as.double(y) :
cannot coerce type 'S4' to vector of type 'double'
> library(raster)
> search()
[1] ".GlobalEnv"        "package:raster"    "package:sp" "tools:rstudio"
[5] "package:stats"     "package:graphics"  "package:grDevices" 
"package:utils"
[9] "package:datasets"  "package:methods"   "Autoloads" "package:base"
> raster:::plot(r)
Erreur dans get(name, envir = asNamespace(pkg), inherits = FALSE) :
objet 'plot' introuvable

Thank you for your help,

Céline

-- 
Céline Bellard, PhD student

Lab ESE, UMR CNRS 8079

Univ Paris-Sud Tel  (0033/0) 1 69 15 56 85

Bat 362

F-91405  Orsay Cedex FRANCE



More information about the R-sig-Geo mailing list