8. The airquality data set has 153 rows, one for each day in May through September of 1973. One of the variables is named ”Wind”, for wind speed. We will calculate some values of the distribution of Wind using R. Suppose we are interested in the proportion of days for which the wind speed was greater than 12. Attach the airquality data frame to your R
workspace with the command
> attach(airquality)
This allows you to address the variable Wind in R without going through bothersome in- termediate steps. The number of days for which Wind was greater than 12 is given by
> sum(Wind > 12)
and the proportion is
> sum(Wind > 12)/153
Find the proportion of days for which Wind is less than or equal to 10. (Hint: Less than or equal in R is denoted by <=).
The R output is:
The R code is:
attach(airquality)
sum(Wind <= 10)
sum(Wind <= 10)/153
The answer is 0.5294118.
Get Answers For Free
Most questions answered within 1 hours.