Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
## Assuming your data frame is called 'my_df'
# First it is necessary to correct any bearings of '0' to '360'
my_df$bearing[my_df$bearing == 0] <- 360
my_df$u <- (1 * my_df$speed) * sin((my_df$bearing * pi / 180.0))
my_df$v <- (1 * my_df$speed) * cos((my_df$bearing * pi / 180.0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment