<div dir="ltr">Hello, <div>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. </div><div><br></div><div><div>> image(year_aegypti@data$repro.rate, col = topo.colors(20))</div><div>Error in image.default(year_aegypti@data$repro.rate, col = topo.colors(20)) : </div><div>  argument must be matrix-like</div><div><br></div><div>Additionally, here is the structure of the SpatialGridDataFrame I am using</div><div><br></div><div><div> str(year_aegypti)</div><div>Formal class 'SpatialGridDataFrame' [package "sp"] with 4 slots</div><div>  ..@ data       :'data.frame':<span class="" style="white-space:pre"> </span>60950 obs. of  2 variables:</div><div>  .. ..$ year_tmean.Aegypti: num [1:60950] NA NA NA NA NA NA NA NA NA NA ...</div><div>  .. ..$ repro.rate        : num [1:60950] NA NA NA NA NA NA NA NA NA NA ...</div><div>  ..@ grid       :Formal class 'GridTopology' [package "sp"] with 3 slots</div><div>  .. .. ..@ cellcentre.offset: num [1:2] -374000 -606000</div><div>  .. .. ..@ cellsize         : num [1:2] 4000 4000</div><div>  .. .. ..@ cells.dim        : int [1:2] 230 265</div><div>  ..@ bbox       : num [1:2, 1:2] -376000 -608000 544000 452000</div><div>  .. ..- attr(*, "dimnames")=List of 2</div><div>  .. .. ..$ : NULL</div><div>  .. .. ..$ : chr [1:2] "min" "max"</div><div>  ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot</div><div>  .. .. ..@ 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__</div></div><div><br></div><div>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. </div><div><br></div><div>When I try spplot I get the following error:</div><div><div> spplot(year_aegypti@data$repro.rate)</div><div>Error in (function (classes, fdef, mtable)  : </div><div>  unable to find an inherited method for function ‘spplot’ for signature ‘"numeric"’</div></div><div><br></div><div>Does anyone have any ideas for solving these issues?</div><div>Thanks!</div><div class="gmail_signature"><div dir="ltr"><div><div><div><span style="color:rgb(153,153,153)"><span style="background-color:rgb(255,255,255)">Marisa Donnelly<br></span></span></div><span style="color:rgb(153,153,153)"><span style="background-color:rgb(255,255,255)">Ph.D. Student<br>Graduate Group in Epidemiology<br></span></span></div><span style="color:rgb(153,153,153)"><span style="background-color:rgb(255,255,255)">University of California, Davis<br></span></span></div><span style="color:rgb(153,153,153)"><a href="mailto:madonnelly@ucdavis.edu" target="_blank">madonnelly@ucdavis.edu</a></span><br></div></div>
</div></div>