[R-sig-Geo] drop layer/band from SpatialGridDataFrame

Andy Bunn Andy.Bunn at wwu.edu
Tue Aug 10 21:57:11 CEST 2010



> -----Original Message-----
> From: Matthew Landis [mailto:landis at isciences.com]
> Sent: Tuesday, August 10, 2010 12:56 PM
> To: r-sig-geo at stat.math.ethz.ch; Andy Bunn
> Subject: Re: [R-sig-Geo] drop layer/band from SpatialGridDataFrame
> 
>   Andy - how about these two options
> 
> monthly.sp at data <- monthly.sp at data[-1,]
> 
> or (cheating with the help of raster package)
> 
> monthly.stack <- as(monthly.sp, 'RasterStack')
> monthly.stack <- dropLayer(monthly.stack, 1)
> monthly.sp <- as(monthly.stack, 'SpatialGridDataFrame')

Great. Thanks! Done.

> 
> Apologies if these are nonsense - I don't have time to actually test
> these out on a toy example at the moment.
> 
> Matt
> 
> On 8/10/2010 3:02 PM, Andy Bunn wrote:
> > I was a bit hasty. The SpatialGridDataFrame contains 325 separate
> grids each with 155 cols and 52 rows. E.g., if it were an array I'd
> think it would have dimensions of 52, 155, 325 and I'd want to do
> something like: monthly.sp[,,-1]. When I'm done I want the object to
> have 324 variables with 8060 obs and keep the cells.dim at 155 by 52.
> >
> 
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~
> 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