How to make boxplots in R using two specific variables

r
kaggle
box_plot

#1

Hi,

I have the dataset from the bike sharing demand problem on kaggle.

str(train)
‘data.frame’: 10886 obs. of 12 variables:
datetime : Factor w/ 10886 levels "2011-01-01 00:00:00",..: 1 2 3 4 5 6 7 8 9 10 ... season : int 1 1 1 1 1 1 1 1 1 1 …
holiday : int 0 0 0 0 0 0 0 0 0 0 ... workingday: int 0 0 0 0 0 0 0 0 0 0 …
weather : int 1 1 1 1 1 2 1 1 1 1 ... temp : num 9.84 9.02 9.02 9.84 9.84 …
atemp : num 14.4 13.6 13.6 14.4 14.4 ... humidity : int 81 80 80 75 75 75 80 86 75 76 …
windspeed : num 0 0 0 0 0 ... casual : int 3 8 5 3 0 0 2 1 1 8 …
registered: int 13 32 27 10 1 1 0 2 7 6 ... count : int 16 40 32 13 1 1 2 3 8 14 …

I want boxplots for weather 1,2 and 3 given that the windspeed=0. How can I do it?
Thanks,
Pravin


#2

hello @pravin,
/* Subset the data for windspeed = 0 */

bike_windspeed0 <- subset(bike,windspeed == 0)
>boxplot(weather~windspeed,bike_windspeed0)