RStudio has created a large number of cheat sheets, including the one-page R Markdown cheat sheet, which are freely available at https://www.rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdflink
##A. Use ?rivers to learn about the data.
?rivers
## starting httpd help server ... done
mean(rivers)
## [1] 591.1844
sd(rivers)
## [1] 493.8708
hist(rivers)
summary(rivers)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 135.0 310.0 425.0 591.2 680.0 3710.0
The min and max functions show the minimum and maximum values of a given dataset.
min(rivers)
## [1] 135
max(rivers)
## [1] 3710
rivers[rivers > 1000]
## [1] 1459 1450 1243 2348 1171 3710 2315 2533 1306 1054 1270 1885 1100 1205 1038
## [16] 1770
According to the data frame airquality , There are a total of 6 variables in the data frame. These variables are used to perform the analysis of the daily air quality.
The Names of the variables are as follows :-
y<-.14
r<-.13
o<-.20
Br<-.12
g<-.20
B<-.21
PartA<-1-g
PartB<-r+o+y
Partc<-1-(1-B)^4
Partd<-r*o*Br*g*B*y
event <- replicate(10000, {
coinToss <- sample(c("H", "T"), 7, replace = TRUE) # Simulate outcome of 7 coin tosses
coinToss
sum(coinToss == "H") # need 3 heads
sum(coinToss == "H") == 3
coinToss[1:7]
sum(coinToss[1:7] == "H") == 3
sum(coinToss == "H") == 3
})
mean(event)
## [1] 0.2743