bici<-read.csv("hour.csv")
head(bici)
## instant dteday season yr mnth hr holiday weekday workingday
## 1 1 2011-01-01 1 0 1 0 0 6 0
## 2 2 2011-01-01 1 0 1 1 0 6 0
## 3 3 2011-01-01 1 0 1 2 0 6 0
## 4 4 2011-01-01 1 0 1 3 0 6 0
## 5 5 2011-01-01 1 0 1 4 0 6 0
## 6 6 2011-01-01 1 0 1 5 0 6 0
## weathersit temp atemp hum windspeed casual registered cnt
## 1 1 0.24 0.2879 0.81 0.0000 3 13 16
## 2 1 0.22 0.2727 0.80 0.0000 8 32 40
## 3 1 0.22 0.2727 0.80 0.0000 5 27 32
## 4 1 0.24 0.2879 0.75 0.0000 3 10 13
## 5 1 0.24 0.2879 0.75 0.0000 0 1 1
## 6 2 0.24 0.2576 0.75 0.0896 0 1 1
names(bici)
## [1] "instant" "dteday" "season" "yr" "mnth"
## [6] "hr" "holiday" "weekday" "workingday" "weathersit"
## [11] "temp" "atemp" "hum" "windspeed" "casual"
## [16] "registered" "cnt"
¿Que mes es el que tiene la mayor demanda?
library(dplyr)
bici<-tbl_df(bici)
bici %>% group_by(yr,mnth) %>% summarise(sum(cnt))
## Source: local data frame [24 x 3]
## Groups: yr
##
## yr mnth sum(cnt)
## 1 0 1 38189
## 2 0 2 48215
## 3 0 3 64045
## 4 0 4 94870
## 5 0 5 135821
## 6 0 6 143512
## 7 0 7 141341
## 8 0 8 136691
## 9 0 9 127418
## 10 0 10 123511
## .. .. ... ...
El mes que tiene la mayor demanda es Junio