Skip to content

Percent argument cannot be passed to group_polys and build_polys when type is kernel

Minimum reproducible examples:

build_polys

# Load data.table and spatsoc
library(data.table)
library(spatsoc)

# Read example data
DT <- fread(system.file("extdata", "DT.csv", package = "spatsoc"))
# Cast the character column to POSIXct
DT[, datetime := as.POSIXct(datetime, tz = 'UTC')]

# Proj4 string for example data
utm <- '+proj=utm +zone=36 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs'

# Build polygons for each individual
build_polys(
  DT,
  projection = utm,
  hrType = 'kernel',
  hrParams = list(grid = 60, h = 'href', percent = 95),
  id = 'ID',
  coords = c('X', 'Y')
)

Error in build_polys(DT, projection = utm, hrType = "kernel", hrParams = list(grid = 60, : hrParams provided do not match function parameters, see ?adehabitatHR::kernelUD

group_polys

# Load data.table and spatsoc
library(data.table)
library(spatsoc)

# Read example data
DT <- fread(system.file("extdata", "DT.csv", package = "spatsoc"))
# Cast the character column to POSIXct
DT[, datetime := as.POSIXct(datetime, tz = 'UTC')]

# Proj4 string for example data
utm <- '+proj=utm +zone=36 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs'

# Group polygons for each individual
group_polys(
  DT,
  area = FALSE,
  projection = utm,
  hrType = 'kernel',
  hrParams = list(grid = 60, h = 'href', percent = 95),
  id = 'ID',
  coords = c('X', 'Y')
)

Error in build_polys(DT = DT, projection = projection, hrType = hrType, : hrParams provided do not match function parameters, see ?adehabitatHR::kernelUD

NOTE: since build_polys is used by group_polys, these can be treated the same and the issue fixed directly in build_polys

Edited by Alec L. Robitaille
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information