Skip to content

Instantly share code, notes, and snippets.

@anirudhjayaraman
Created December 17, 2015 13:30
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/6b366ac7b406eb9dff68 to your computer and use it in GitHub Desktop.
Save anirudhjayaraman/6b366ac7b406eb9dff68 to your computer and use it in GitHub Desktop.
Comparisons between base R and dplyr`
# Some comparisons to basic R
# both hflights and dplyr are available
ex1r <- hflights[c("TaxiIn","TaxiOut","Distance")]
ex1d <- select(hflights, TaxiIn, TaxiOut, Distance)
ex2r <- hflights[c("Year","Month","DayOfWeek","DepTime","ArrTime")]
ex2d <- select(hflights, Year:ArrTime, -DayofMonth)
ex3r <- hflights[c("TailNum","TaxiIn","TaxiOut")]
ex3d <- select(hflights, TailNum, contains("Taxi"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment