Learn R Programming

trajectories (version 0.2-1)

as.Track: Converts data to an object of class "Track"

Description

Function as.Track accepts converts x,y coordinates and thier corresponding time/date to an object of class Track. It can also accepts covariates for the corresponding locations, covariates must be a dataframe with some columns and length of each column is equal to length of x,y,t.

Usage

as.Track(x,y,t,covariate)

Arguments

x

x coordinate.

y

y coordinate.

t

corresponding time and date of x,y.

covariate

additional information.

Value

An object of class "Track".

Details

An object of class "Track" can be created by some geographical locations and corresponding time/dates. Function as.Track converts locations and dates/times to an object of class "Track". time/date should be from class "POSIXct" "POSIXt". See example below.

See Also

Track, as.POSIXct

Examples

Run this code
# NOT RUN {
x <- runif(10,0,1)
y <- runif(10,0,1)
date <- seq(as.POSIXct("2015-1-1 0:00"), as.POSIXct("2015-1-1 9:00"), by = "hour")
Z <- as.Track(x,y,date)
plot(Z)
# }

Run the code above in your browser using DataLab