Skip to content

Instantly share code, notes, and snippets.

@anirudhjayaraman
Created December 17, 2015 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anirudhjayaraman/9b3a12f690cf7d34e12f to your computer and use it in GitHub Desktop.
Save anirudhjayaraman/9b3a12f690cf7d34e12f to your computer and use it in GitHub Desktop.
Mutate
# Add the new variable ActualGroundTime to a copy of hflights and save the result as g1.
g1 <- mutate(hflights, ActualGroundTime = ActualElapsedTime - AirTime)
# Add the new variable GroundTime to a g1. Save the result as g2.
g2 <- mutate(g1, GroundTime = TaxiIn + TaxiOut)
# Add the new variable AverageSpeed to g2. Save the result as g3.
g3 <- mutate(g2, AverageSpeed = Distance / AirTime * 60)
# Print out g3
g3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment