R version 4.0.0 (2020-04-24) – “Arbor Day” Copyright (C) 2020 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type ‘license()’ or ‘licence()’ for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors. Type ‘contributors()’ for more information and ‘citation()’ on how to cite R or R packages in publications.
Type ‘demo()’ for some demos, ‘help()’ for on-line help, or ‘help.start()’ for an HTML browser interface to help. Type ‘q()’ to quit R.
[Workspace loaded from ~/.RData]
install.packages(“tidyverse”) WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/ Installing package into ‘C:/Users/Jerome/Documents/R/win-library/4.0’ (as ‘lib’ is unspecified) trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.0/tidyverse_1.3.0.zip’ Content type ‘application/zip’ length 440034 bytes (429 KB) downloaded 429 KB
package ‘tidyverse’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in C:8sQgc_packages > library(tidyverse) – Attaching packages ————————————— tidyverse 1.3.0 – v ggplot2 3.3.1 v purrr 0.3.4 v tibble 3.0.1 v dplyr 1.0.0 v tidyr 1.1.0 v stringr 1.4.0 v readr 1.3.1 v forcats 0.5.0 – Conflicts —————————————— tidyverse_conflicts() – x dplyr::filter() masks stats::filter() x dplyr::lag() masks stats::lag() > str(airquality) ‘data.frame’: 153 obs. of 6 variables: $ Ozone : int 41 36 12 18 NA 28 23 19 8 NA … $ Solar.R: int 190 118 149 313 NA NA 299 99 19 194 … $ Wind : num 7.4 8 12.6 11.5 14.3 14.9 8.6 13.8 20.1 8.6 … $ Temp : int 67 72 74 62 56 66 65 59 61 69 … $ Month : int 5 5 5 5 5 5 5 5 5 5 … $ Day : int 1 2 3 4 5 6 7 8 9 10 … > mean(airquality\(Temp) [1] 77.88235 > median(airquality\)Temp) [1] 79 > sd(airquality\(Temp) [1] 9.46527 > var(airquality\)Temp) [1] 89.59133 > sd(wind\(Temp) Error in is.data.frame(x) : object 'wind' not found > sd(airquality\)Wind) [1] 3.523001 > var(airquality\(Wind) [1] 12.41154 > airquality\)Month[airquality$Month == 5]<- “May” > airquality\(Month[airquality\)Month == 6]<- “June” > airquality\(Month[airquality\)Month == 7]<- “July” > airquality\(Month[airquality\)Month == 8]<- “August” > airquality\(Month[airquality\)Month == 9]<- “September” > str(airquality) ‘data.frame’: 153 obs. of 6 variables: $ Ozone : int 41 36 12 18 NA 28 23 19 8 NA … $ Solar.R: int 190 118 149 313 NA NA 299 99 19 194 … $ Wind : num 7.4 8 12.6 11.5 14.3 14.9 8.6 13.8 20.1 8.6 … $ Temp : int 67 72 74 62 56 66 65 59 61 69 … $ Month : chr “May” “May” “May” “May” … $ Day : int 1 2 3 4 5 6 7 8 9 10 … > summary(airquality) Ozone Solar.R Wind Temp Month Day
Min. : 1.00 Min. : 7.0 Min. : 1.700 Min. :56.00 Length:153 Min. : 1.0
1st Qu.: 18.00 1st Qu.:115.8 1st Qu.: 7.400 1st Qu.:72.00 Class :character 1st Qu.: 8.0
Median : 31.50 Median :205.0 Median : 9.700 Median :79.00 Mode :character Median :16.0
Mean : 42.13 Mean :185.9 Mean : 9.958 Mean :77.88 Mean :15.8
3rd Qu.: 63.25 3rd Qu.:258.8 3rd Qu.:11.500 3rd Qu.:85.00 3rd Qu.:23.0
Max. :168.00 Max. :334.0 Max. :20.700 Max. :97.00 Max. :31.0
NA’s :37 NA’s :7
> airquality\(Month<-factor(airquality\)Month, levels=c(“May”, “June”,“July”, “August”, “September”)) > p1 <- qplot(data = airquality,Temp,fill = Month,geom = “histogram”, bins = 20) > pl Error: object ‘pl’ not found > p1 <- qplot(data = airquality,Temp,fill = Month,geom = “histogram”, bins = 20) > p1 <- qplot(data = airquality,Temp,fill = Month,geom = “histogram”, bins = 20) > p1 > p2 <- airquality %>% + ggplot(aes(x=Temp, fill=Month)) + + geom_histogram(position=“identity”, alpha=0.5, binwidth = 5, color = “white”)+ + scale_fill_discrete(name = “Month”, labels = c(“May”, “June”,“July”, “August”, “September”)) > p2 > p3 <- airquality %>% + ggplot(aes(Month, Temp, fill = Month)) + + ggtitle(“Temperatures”) + + xlab(“Months”) + + ylab(“Frequency”) + + geom_boxplot() + + scale_fill_discrete(name = “Month”, labels = c(“May”, “June”,“July”, “August”, “September”)) > p3 > p4 <- airquality %>% + ggplot(aes(Month, Temp, fill = Month)) + + ggtitle(“Temperatures”) + + xlab(“Temperatures”) + + ylab(“Frequency”) + + geom_boxplot()+ + scale_fill_grey(name = “Month”, labels = c(“May”, “June”,“July”, “August”, “September”)) > p4 > p5 <- airquality %>% + ggplot(aes(Month, Wind, fill = Month)) + + ggtitle(“Wind”) + + xlab(“Months”) + + ylab(“Frequency”) + + geom_boxplot() + + scale_fill_discrete(name = “Month”, labels = c(“May”, “June”,“July”, “August”, “September”)) > p5 >