Skip to content

Instantly share code, notes, and snippets.

@anirudhjayaraman
Created December 18, 2015 12:51
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/69c14dc35b13c66b2319 to your computer and use it in GitHub Desktop.
Save anirudhjayaraman/69c14dc35b13c66b2319 to your computer and use it in GitHub Desktop.
# Generate summarizing statistics for hflights
summarise(hflights, n_obs = n(), n_carrier = n_distinct(UniqueCarrier),
n_dest = n_distinct(Dest), dest100 = nth(Dest, 100))
# Filter hflights to keep all American Airline flights: aa
aa <- filter(hflights, UniqueCarrier == "American")
# Generate summarizing statistics for aa
summarise(aa, n_flights = n(), n_canc = sum(Cancelled),
p_canc = 100*(n_canc/n_flights), avg_delay = mean(ArrDelay, na.rm = TRUE))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment