[R-sig-Geo] Large Data Sets

Michael Sumner mdsumner at utas.edu.au
Tue Sep 4 14:21:11 CEST 2007


Caroline Keef wrote:
> I am having trouble manipulating a large data set to change a spatial
> polygons data frame
>
> I have read in an ESRI polygon shapefile using rgdal and readOGR that
> contains 18804 polygons.  I am trying to add two variables into the
> spatial data frame but it's not working.  I'm doing this using
>
> cbind(SpatialPolygonsDataFrame,new variable,rank(new variable)).
>
>   
Try

spdf$newvariable <- newvariable
spdf$ranknewvariable <- rank(newvariable)

or similar, depending on your actual variable and column names, and the 
workflow used to generate your vectors.

This would be identical, exploiting the features of data frames via SPDF 
methods (again, depending on your actual names):

spdf[["newvariable"]] <- newvariable
spdf[["ranknewvariable"]] <- rank(newvariable)


Using cbind like that looks like it will coerce to matrix, but it's not 
going to do what you want. You could  access the underlying spdf at data 
more directly,  but using the method syntax for data frames is advisable.

Cheers, Mike.
> Before I killed R Task Manager said it was using more than 1,050,000K
> virtual memory, which given my whole computer ground to a halt I'm
> guessing is the limit!
>
> I regularly handle larger data frames than this using R without any
> problem so I don't think the problem is R in general.  
>
> Does anyone have any suggestions as to either the size of the data set
> that it is possible to handle as a spatial data frame or a better way of
> combining spatial data frames?
>
> Thank you
>
> Caroline
>  
> JBA Consulting - Engineers and Scientists
> South Barn, Broughton Hall, Skipton, North Yorkshire, BD23 3AE, UK
> t: +44 (0)1756 799919   f: +44 (0)1756 799449
>  
> JBA is a Carbon Neutral Company.  Please don't print this e-mail unless you really need to.
> This email is covered by JBA Consulting's email disclaimer at www.jbaconsulting.co.uk/emaildisclaimer
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
>




More information about the R-sig-Geo mailing list