View source: R/downsampleXYZ.R
downsampleXYZ | R Documentation |
Downsample high-resolution *(x,y,t)* or *(x,y,z,t)* data to match a minimum spatial resolution.
downsampleXYZ(
data,
t_step,
t_cut = t_step * 10,
x = "x",
y = "y",
z = NULL,
t = "t",
ID = "ID"
)
data |
A data.frame or something coercible to a data.table containing all observations |
t_step |
The smallest allowable median time interval between observations.
Any track with a median value below this will be resampled to a track of
equally-spaced observations with time difference |
t_cut |
A numeric. Any gap exceeding this value in seconds in a given
track will be treated as the start of a new segment. Default is |
x |
A character string representing the data column containing the 'x' coordinates in any projection. |
y |
A character string representing the data column containing the 'y' coordinates in any projection. |
z |
Optional. A character string representing the data column containing the 'z' elevations. |
t |
A character string representing the data column containing the time values, either as a numeric of successive seconds or as a date time string |
ID |
A character string representing the data column containing the unique ID for each observed trajectory. In other words, each set of points for each continuous observation for each observed individual would merit a unique id. |
A data.table, containing the original input data but with all
overly-high resolution tracks downsampled to an acceptable rate of observations
and column names prepared for the getVelocity
function.
# Generate fake data with x,y coordinates, z elevation, and a t
# column representing the number of seconds into the observation
data <- data.table(x = runif(10000,10000,20000),
y = runif(10000,30000,40000),
z = runif(10000,0,200),
t = 1:1000,
ID = rep(1:10,each=1000))
# Set the minimum value at 3 seconds
data <- downsampleXYZ(data = data, t_step = 3, z = 'z')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.