Hello, I am trying to plot the image of the data from a SpatialGridDataFrame with two variables per pixel in R studio. Here is the line I am using and the error message I receive after.
> image(year_aegypti@data$repro.rate, col = topo.colors(20)) Error in image.default(year_aegypti@data$repro.rate, col = topo.colors(20)) : argument must be matrix-like Additionally, here is the structure of the SpatialGridDataFrame I am using str(year_aegypti) Formal class 'SpatialGridDataFrame' [package "sp"] with 4 slots ..@ data :'data.frame': 60950 obs. of 2 variables: .. ..$ year_tmean.Aegypti: num [1:60950] NA NA NA NA NA NA NA NA NA NA ... .. ..$ repro.rate : num [1:60950] NA NA NA NA NA NA NA NA NA NA ... ..@ grid :Formal class 'GridTopology' [package "sp"] with 3 slots .. .. ..@ cellcentre.offset: num [1:2] -374000 -606000 .. .. ..@ cellsize : num [1:2] 4000 4000 .. .. ..@ cells.dim : int [1:2] 230 265 ..@ bbox : num [1:2, 1:2] -376000 -608000 544000 452000 .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : NULL .. .. ..$ : chr [1:2] "min" "max" ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot .. .. ..@ projargs: chr "+proj=aea +lat_1=34 +lat_2=40.5 +lat_0=0 +lon_0=-120 +x_0=0 +y_0=-4000000 +no_defs +a=6378137 +rf=298.257222101 +towgs84=0.000,"| __truncated__ I would like to plot only the second variable in the dataframe, $year_tmean.Aegypti, but can't quite figure out how. There are NAs in both variables, in addition to real numbers. When I try spplot I get the following error: spplot(year_aegypti@data$repro.rate) Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘spplot’ for signature ‘"numeric"’ Does anyone have any ideas for solving these issues? Thanks! Marisa Donnelly Ph.D. Student Graduate Group in Epidemiology University of California, Davis madonne...@ucdavis.edu
_______________________________________________ grass-stats mailing list grass-stats@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-stats