0

I'm applying the function image(cp) to gps data but when I do so it throws up the following error

Error in image(as(x, "SpatialGridDataFrame"), ...) : 
  error in evaluating the argument 'x' in selecting a method for function 'image': Error: cannot allocate vector of size 12.3 Mb

The SpatialPointsDataFrame of my relocation gps data has two columns. One with the coordinates, the other with the ID of the animal.

I'm running it on a 32 bit system with 4 gigs of RAM.

How do I get around this?

mdsumner
  • 29,099
  • 6
  • 83
  • 91
  • 3
    Install more memory? But seriously now, please help us help you by providing us with a reproducible example (i.e. code and example data), see http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example for details. – Paul Hiemstra May 21 '13 at 12:13
  • R might not be using all of the memory it can. First clean your workspace with `rm`, then take a look at `?memory.limt` to see how to check how much RAM is alotted to R and how to request more. – Matthew Plourde May 21 '13 at 12:30

1 Answers1

1

One way that might work with no thinking required:

library(raster)
r <- raster(cp)
image(r)

But, you say cp is "gps data" so it's not at all clear why this would be imageable.

One thing you can do is plot it:

plot(cp)

That will work for a SpatialPointsDataFrame. If you want to create an image from this somehow you'll need to specify some details.

mdsumner
  • 29,099
  • 6
  • 83
  • 91