```r
library(ggplot2)
summary(faithful)
## eruptions waiting
## Min. :1.600 Min. :43.0
## 1st Qu.:2.163 1st Qu.:58.0
## Median :4.000 Median :76.0
## Mean :3.488 Mean :70.9
## 3rd Qu.:4.454 3rd Qu.:82.0
## Max. :5.100 Max. :96.0
summary(airquality)
## Ozone Solar.R Wind Temp
## Min. : 1.00 Min. : 7.0 Min. : 1.700 Min. :56.00
## 1st Qu.: 18.00 1st Qu.:115.8 1st Qu.: 7.400 1st Qu.:72.00
## Median : 31.50 Median :205.0 Median : 9.700 Median :79.00
## Mean : 42.13 Mean :185.9 Mean : 9.958 Mean :77.88
## 3rd Qu.: 63.25 3rd Qu.:258.8 3rd Qu.:11.500 3rd Qu.:85.00
## Max. :168.00 Max. :334.0 Max. :20.700 Max. :97.00
## NA's :37 NA's :7
## Month Day
## Min. :5.000 Min. : 1.0
## 1st Qu.:6.000 1st Qu.: 8.0
## Median :7.000 Median :16.0
## Mean :6.993 Mean :15.8
## 3rd Qu.:8.000 3rd Qu.:23.0
## Max. :9.000 Max. :31.0
##
summary(mtcars)
## mpg cyl disp hp
## Min. :10.40 Min. :4.000 Min. : 71.1 Min. : 52.0
## 1st Qu.:15.43 1st Qu.:4.000 1st Qu.:120.8 1st Qu.: 96.5
## Median :19.20 Median :6.000 Median :196.3 Median :123.0
## Mean :20.09 Mean :6.188 Mean :230.7 Mean :146.7
## 3rd Qu.:22.80 3rd Qu.:8.000 3rd Qu.:326.0 3rd Qu.:180.0
## Max. :33.90 Max. :8.000 Max. :472.0 Max. :335.0
## drat wt qsec vs
## Min. :2.760 Min. :1.513 Min. :14.50 Min. :0.0000
## 1st Qu.:3.080 1st Qu.:2.581 1st Qu.:16.89 1st Qu.:0.0000
## Median :3.695 Median :3.325 Median :17.71 Median :0.0000
## Mean :3.597 Mean :3.217 Mean :17.85 Mean :0.4375
## 3rd Qu.:3.920 3rd Qu.:3.610 3rd Qu.:18.90 3rd Qu.:1.0000
## Max. :4.930 Max. :5.424 Max. :22.90 Max. :1.0000
## am gear carb
## Min. :0.0000 Min. :3.000 Min. :1.000
## 1st Qu.:0.0000 1st Qu.:3.000 1st Qu.:2.000
## Median :0.0000 Median :4.000 Median :2.000
## Mean :0.4062 Mean :3.688 Mean :2.812
## 3rd Qu.:1.0000 3rd Qu.:4.000 3rd Qu.:4.000
## Max. :1.0000 Max. :5.000 Max. :8.000
summary(iris)
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## Min. :4.300 Min. :2.000 Min. :1.000 Min. :0.100
## 1st Qu.:5.100 1st Qu.:2.800 1st Qu.:1.600 1st Qu.:0.300
## Median :5.800 Median :3.000 Median :4.350 Median :1.300
## Mean :5.843 Mean :3.057 Mean :3.758 Mean :1.199
## 3rd Qu.:6.400 3rd Qu.:3.300 3rd Qu.:5.100 3rd Qu.:1.800
## Max. :7.900 Max. :4.400 Max. :6.900 Max. :2.500
## Species
## setosa :50
## versicolor:50
## virginica :50
##
##
##
library(readr)
Assignment5_Data <- read_csv("~/Assignment5_Data.csv")
## Rows: 404 Columns: 9
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): STATION, NAME
## dbl (6): DAPR, MDPR, PRCP, TMAX, TMIN, TOBS
## date (1): DATE
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
summary(Assignment5_Data)
## STATION NAME DATE DAPR
## Length:404 Length:404 Min. :2023-01-01 Min. :2
## Class :character Class :character 1st Qu.:2023-04-29 1st Qu.:2
## Mode :character Mode :character Median :2023-09-04 Median :2
## Mean :2023-08-24 Mean :2
## 3rd Qu.:2023-12-15 3rd Qu.:2
## Max. :2024-04-01 Max. :2
## NA's :403
## MDPR PRCP TMAX TMIN TOBS
## Min. :0.75 Min. :0.0000 Min. :60.00 Min. :44.00 Min. :44
## 1st Qu.:0.75 1st Qu.:0.0000 1st Qu.:78.00 1st Qu.:66.00 1st Qu.:70
## Median :0.75 Median :0.0000 Median :83.00 Median :72.00 Median :74
## Mean :0.75 Mean :0.1925 Mean :83.26 Mean :70.38 Mean :73
## 3rd Qu.:0.75 3rd Qu.:0.0900 3rd Qu.:88.00 3rd Qu.:76.00 3rd Qu.:78
## Max. :0.75 Max. :8.5800 Max. :98.00 Max. :83.00 Max. :86
## NA's :403 NA's :3 NA's :8 NA's :7 NA's :6
quantile_value_data <- quantile(Assignment5_Data$TMAX, probs = 0.5, na.rm = TRUE)
cat("\nSecond quantile for TMAX in imported dataset:", quantile_value_data, "\n")
##
## Second quantile for TMAX in imported dataset: 83
ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, color = Species)) +
geom_point() +
labs(title = "Scatter plot of Sepal Length vs Sepal Width (iris dataset)", x = "Sepal Length", y = "Sepal Width")

library(ggplot2)
ggplot(mtcars, aes(x = wt, y = mpg, color = as.factor(cyl))) +
geom_point() +
labs(title = "Scatter plot of Weight vs MPG (mtcars dataset)", x = "Weight", y = "MPG")

ggplot(airquality, aes(x = Temp, y = Ozone, color = Month)) +
geom_point() +
labs(title = "Scatter plot of Temperature vs Ozone (airquality dataset)", x = "Temperature", y = "Ozone")
## Warning: Removed 37 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(faithful, aes(x = eruptions, y = waiting)) +
geom_point() +
labs(title = "Scatter plot of Eruptions vs Waiting Time (faithful dataset)", x = "Eruption Duration", y = "Waiting Time")

Assignment5_Data <- read_csv("~/Assignment5_Data.csv")
## Rows: 404 Columns: 9
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): STATION, NAME
## dbl (6): DAPR, MDPR, PRCP, TMAX, TMIN, TOBS
## date (1): DATE
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
ggplot(Assignment5_Data, aes(x = DATE, y = TMIN)) +
geom_point() +
labs(title = "Temperature Min by Date", x = "DATE", y = "TMIN")
## Warning: Removed 7 rows containing missing values or values outside the scale range
## (`geom_point()`).

plot_types <- c("Scatter", "Scatter", "Scatter", "Scatter", "Scatter")
plot_counts <- table(plot_types)
pie(plot_counts, labels = names(plot_counts), main = "Distribution of Plot Types")
