[R-sig-Geo] drop layer/band from SpatialGridDataFrame
Michael Sumner
mdsumner at gmail.com
Tue Aug 10 10:53:53 CEST 2010
Gah - I was mixed up with SpatialPointsDataFrame.
My suggestion should have been this:
monthly.sp <- monthly.sp[,,-1]
Thanks Jaime, I didn't know there was 3 index extract methods for SGDF.
Cheers, Mike.
On Tue, Aug 10, 2010 at 6:24 PM, Jaime R. Garcia Marquez
<jaime.garcia at uni-bonn.de> wrote:
> I think with 'SpatialGridDataFrames' you should do
>
> monthly.sp <- monthly.sp[,,-1]
>
> Note the two commas in the index[].
> First index rows, second columns, and third variables.
>
> HTH
>
> On Tue, 10 Aug 2010 16:28:18 +1000
> Michael Sumner <mdsumner at gmail.com> wrote:
>>
>> Do you mean "layer" as in the first column in the data.frame?
>>
>> Does this do what you want? The negative index means "everything but
>> these indexes".
>>
>> monthly.sp <- monthly.sp[,-1]
>>
>>
>>
>> On Tue, Aug 10, 2010 at 12:40 PM, Andy Bunn <Andy.Bunn at wwu.edu> wrote:
>>>
>>> I have a SpatialGridDataFrame with 325 variables in the @ data slot. I
>>> want to drop the first layer. Seems simple enough. Any help? Thanks, Andy
>>>
>>>> str(monthly.sp)
>>>
>>> Formal class 'SpatialGridDataFrame' [package "sp"] with 6 slots
>>> ..@ data :'data.frame': 8060 obs. of 325 variables:
>>> .. ..$ values: num [1:8060] 127.5 31.9 127.5 127.5 231.1 ...
>>> .. ..$ values: num [1:8060] 127.5 31.9 127.5 127.5 231.1 ...
>>> .. and so on
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>
>>
>>
>> --
>> Michael Sumner
>> Institute for Marine and Antarctic Studies, University of Tasmania
>> Hobart, Australia
>> e-mail: mdsumner at gmail.com
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
>
>
--
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsumner at gmail.com
More information about the R-sig-Geo
mailing list