Created
June 12, 2017 17:08
-
-
Save robwschlegel/0ae1d46368848f3f32488a3ab2202a3e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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