[R-sig-Geo] spplot error with rasterStack

Matt Landis landis at isciences.com
Thu Jun 14 19:51:21 CEST 2012


Hello all,

I am tempted to use spplot with a RasterStack, but for some reason, I
keep getting an error.  Maybe someone out there has experienced the
same thing?  See below.

st <- created from 9 IMG files

> st
class       : RasterStack
dimensions  : 360, 720, 259200, 9  (nrow, ncol, ncell, nlayers)
resolution  : 0.5, 0.5  (x, y)
extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0
min values  : 0.010, 0.010, 0.010, 0.010, 0.010, 0.055, 0.019, 0.053, 0.015
max values  : 0.99, 0.99, 0.99, 0.99, 0.99, 0.98, 0.98, 0.99, 0.99
layer names : Jul.2012, Aug.2012, Sep.2012, Oct.2012, Nov.2012,
Dec.2012, Jan.2013, Feb.2013, Mar.2013

> spplot(st)
Error in nchar(filename) :
  no slot of name "file" for this object of class "RasterStack"
In addition: Warning message:
In if (rotated | cells | (.driver(x, FALSE) != "gdal")) { :
  the condition has length > 1 and only the first element will be used

However
> spplot(as(st, 'SpatialGridDataFrame'))
>
is successful.

I am able to run the example in the spplot raster documentation with no errors.

> r <- raster(system.file("external/test.grd", package="raster"))
> s <- stack(r, r*2)
> layerNames(s) <- c('meuse', 'meuse x 2')
>
> spplot(s)
>

I am running on Windows Server 2008 R2, plus...
> sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets
methods   base

other attached packages:
[1] rgdal_0.7-11        zoo_1.7-7           rasterVis_0.10-9
hexbin_1.26.0       latticeExtra_0.6-19
[6] RColorBrewer_1.0-5  lattice_0.20-6      raster_1.9-92
sp_0.9-99

loaded via a namespace (and not attached):
[1] tools_2.15.0


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Matthew Landis, Ph.D.
Research Scientist
ISciences, LLC
61 Main St., Suite 200
Burlington VT 05401

802-864-2999
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the R-sig-Geo mailing list