R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

install.packages("tidyverse")
install.packages("nycflights13")
install.packages("dplyr")
rm(list=ls())
library(tidyverse)
library(nycflights13)
library(dplyr)
data(flights)
data(airlines)
data(airports)
data(weather)
force(flights)
force(airlines)
force(airports)
force(weather)
select(flights,year,month,day,arr_delay,dep_time,sched_dep_time,dep_delay,arr_time,sched_arr_time,carrier)
filter(flights, month == 1, day == 1)
filter(flights, !(arr_delay > 120 ))
arrange(flights, desc(arr_delay))
by_day <- group_by(flights, carrier)
arrdelay<-summarise(by_day, delay = mean(arr_delay, na.rm = TRUE))
arrange(arrdelay, desc(delay))
by_hour <- group_by(flights, hour)
arrivaldelay<-summarise(by_hour, delay = mean(arr_delay, na.rm = TRUE))
arrange(arrivaldelay, desc(delay))
ans6<-head(flights,100)%>%select(year, month,day,hour,origin,dest,tailnum,carrier)%>%left_join(airlines)
ans6%>%left_join(weather)%>%left_join(airports)
subflights<-subset(flights, dest %in% c("ALB", "BDL", "BTV"))
subflights
select(subflights,carrier,dest)
count(subflights,dest)
by_com <- group_by(flights, carrier,month,origin)
summarise(by_com, delay = mean(dep_delay, na.rm = TRUE))

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.