1

I am trying to calculate MCP and KDE on a vhf tracking data, my dataframe has three columns, Individual, Lat and Long.

I am trying following the adahabitatHR vignette to try and create a SpatialPointsDataFrame that contains vhf data on multiple individuals (https://cran.r-project.org/web/packages/adehabitatHR/vignettes/adehabitatHR.pdf), but using my own dataset.

I load my data

vhf <- read.csv("vhfdatacrom.csv")`
str(vhf)

data.frame': 186 obs. of 3 variables: $ Individual: Factor w/ 12 levels "PM01","PM03",..: 2 1 2 2 1 1 1 1 1 4 ... $ Lat : num 54.2 54.2 54.2 54.2 54.2 ... $ Long : num -7.44 -7.42 -7.45 -7.44 -7.42 ...

> coords.data.xy <- vhf[c("Long", "Lat")]
> id <- vhf[c("Individual")]
> idsp <- data.frame(id)
> coordinates(idsp) <- coords.data.xy
> class(idsp)

[1] "SpatialPointsDataFrame" attr(,"package") [1] "sp"

> clusthr(idsp)

Error in tmp[1, ] : subscript out of bounds

I have tinkered all I can but cannot get this to run, any help would be appreciated.

Thank you

0 Answers0