step_length: Step Length

Description Usage Arguments Examples

View source: R/step_length.R

Description

Calculate basic step length with data.table

Usage

1
2
3
step_length(DT, coords = c("EASTING", "NORTHING"), time = "datetime",
  splitBy = c("id", "yr"), moverate = FALSE, type = "lag",
  preserve = FALSE)

Arguments

DT

data.table

coords

character vector, length 2, coordinate column names. UTM required.

time

character time column name.

splitBy

character vector of column names to split step length calculation by. default is id and yr (individual identifier and year as numeric).

moverate

calculate movement rate? stepLength / dif time, unit hours.

type

default: lag. alternative: lead.

preserve

preserve intermediate cols? default: no.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Load data.table
library(data.table)

# Read example data
DT <- fread(system.file("extdata", "DT.csv", package = "toast"))

DT[, datetime := as.POSIXct(datetime)]

DT[, yr := year(datetime)]

step_length(DT, coords = c('X', 'Y'), splitBy = c('ID', 'yr'))

robitalec/toast documentation built on May 17, 2019, 3:14 a.m.