Skip to content

Instantly share code, notes, and snippets.

@AhsanSN
Created July 15, 2018 05:26
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 AhsanSN/02f263143c41cf94270a5f8e9dee79c2 to your computer and use it in GitHub Desktop.
Save AhsanSN/02f263143c41cf94270a5f8e9dee79c2 to your computer and use it in GitHub Desktop.
> library(dplyr)
> library(ggplot2)
> library(statsr)
> data(nycflights)
//ggplot
> ggplot(data = nycflights, aes(x= dep_delay)) +geom_histogram()
//mean
> nycflights %>% summarise(mean_dd = mean(dep_delay))
//median
> nycflights %>% summarise(mean_dd = median(dep_delay))
//boxplot
> ggplot(data = nycflights, aes(x="",y= dep_delay)) +geom_boxplot()
//comparision between months
> ggplot(data = nycflights, aes(x=factor(month),y= dep_delay)) +geom_boxplot()
//mean of each month [piping]
> nycflights %>% group_by(month) %>% summarise(median_dd = mean(dep_delay)) %>% arrange(desc(median_dd))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment