circAngles | R Documentation |
This function can be used to convert angular covariates (e.g., ocean currents, wind direction) measured in radians relative to the x-axis to turning angle
covariates sutiable for circular-circular regression in fitHMM
or MIfitHMM
.
circAngles(refAngle, data, coordNames = c("x", "y"))
refAngle |
Numeric vector of standard direction angles (in radians) relative to the x-axis, where 0 = east, pi/2 = north, pi = west, -pi/2 = south |
data |
data frame containing fields for the x- and y-coordinates (identified by |
coordNames |
Names of the columns of coordinates in |
A vector of turning angles between the movement direction at time step t-1 and refAngle
at time t
# extract data from momentuHMM example data<-example$m$data # generate fake angle covariates u <- rnorm(nrow(data)) # horizontal component v <- rnorm(nrow(data)) # vertical component refAngle <- atan2(v,u) # add turning angle covariate to data data$cov3 <- circAngles(refAngle=refAngle,data=data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.