set_data_format {swaRmverse}R Documentation

Data Formatting

Description

This function is a wrapper for the track function of the trackdf package.

Usage

set_data_format(
  raw_x,
  raw_y,
  raw_t,
  raw_id,
  origin,
  period,
  tz,
  proj,
  format,
  ...
)

Arguments

raw_x

A numeric vector representing the x coordinates of individual(s).

raw_y

A numeric vector representing the y coordinates of individual(s).

raw_t

A numeric vector that can be coerced to date-time objects by as datetime representing the times (or frames) at which each location was recorded.

raw_id

A vector representing the identity of each coordinate recording.

origin

Something that can be coerced to a date-time object by as_ datetime representing the start date and time of the observations when t is a numeric vector.

period

A character vector in a shorthand format (e.g. "1 second") or ISO 8601 specification. This is used when t is a numeric vector to represent time unit of the observations.

tz

A time zone name. See OlsonNames.

proj

A character string or a sp::CRS object representing the projection of the coordinates. Leave empty if the coordinates are not projected (e.g., output of video tracking). "+proj=longlat" is suitable for the output of most GPS trackers.

format

A character string indicating the formatting of 't'. See strptime for how to specify this parameter.

...

Additional vectors representing categories that the data should be split by. If none, only the date will be used as a unit of data separation.

Value

A track dataframe table, which is a colloquial term for an object of class track.

Author(s)

Marina Papadopoulou m.papadopoulou.rug@gmail.com

Examples


raw_data <- data.frame(
 frame = rep(1:25, 3),
 x = rnorm(75),
 y = rnorm(75),
 id = c(rep(1, 25), rep(2, 25), rep(3, 25))
 )

data <- set_data_format(
 raw_x = raw_data$x,
 raw_y = raw_data$y,
 raw_t = raw_data$frame,
 raw_id = raw_data$id,
 period = 1,
 origin = Sys.time(),
 tz = "Africa/Windhoek"
 )


[Package swaRmverse version 0.1.0 Index]