[R-sig-Geo] placing spdf back into adehabiatHR estUDm
Elizabeth Hartel
ehartel at hboi.fau.edu
Fri Feb 1 20:41:41 CET 2013
Hi Phil,
You should be able to use the following to covert it into a
SpatialPixelsDataFrame:
> hab <- as(hab, "SpatialPixelsDataFrame")
Good luck!
Liz
Phil H wrote
> Hi,
>
> This looks to be exactly the solution i am looking for- I am analysing
> some telemetry data in a reservoir which is too complex to meet the
> boundary rules.
> However I am having a little trouble with the example code....its
> probably something I have done but.....
>
>
> library(adehabitatHR)
> data(puechabonsp)
> loc <- puechabonsp$relocs
> elev <- puechabonsp$map
> fullgrid(elev) <- TRUE
> hab <- elev
> hab[[1]] <- as.numeric(!is.na(hab[[1]]))
>
> #everything works good up till here
> ud <- kernelUD(loc[,1], grid=hab)
>
> #when i get to this point I get the following error message
>
> error in .kernelUDs(SpatialPoints(x, proj4string =
> CRS(as.character(pfs1))), :
> grid should be a number or an object inheriting the class SpatialPixels
>
> #i notice that when I run
>
>> class(hab)
> [1] "SpatialGridDataFrame"
> attr(,"package")
> [1] "sp"
>
>
> #it appears to be a class SpatialGridDataFrame. and the grid function
> needs to be of the class SpatialPixels
>
> #so I tried
>
> hab<-SpatialPixels(hab)
>
> however this doesnt seem to work i get the error
>
>> hab2<-SpatialPixels(hab)
> Error in SpatialPixels(hab) :
> points should be of class or extending SpatialPoints
>
> I am a bit of a beginner using sp and adehabitathr packages so i expect it
> is something silly
> however I just cant seem to recetify this
>
> Thanks for your time
> Phil H
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Walruses-and-adehabitatHR-class-estUDm-exclusion-of-non-habitat-pixels-and-summary-over-all-animals-tp6497315p7582460.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list