library(ggplot2)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.2.1     ✔ readr     2.2.0
## ✔ forcats   1.0.1     ✔ stringr   1.6.0
## ✔ lubridate 1.9.5     ✔ tibble    3.3.1
## ✔ purrr     1.2.2     ✔ tidyr     1.3.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(dplyr)
# data cleaning
clean_data <- airquality %>%
  filter(!is.na(Wind)) %>%                     
  group_by(Month) %>%                           
  summarize(avg_wind = mean(Wind, na.rm = TRUE)) 

# bar graph
ggplot(clean_data, aes(x = factor(Month), y = avg_wind, fill = factor(Month))) +
  geom_bar(stat = "identity") +
  labs(title = "Month of Average Wind",
       x = "Month",
       y = "Average of Wind") +
  theme_minimal() +
  theme(legend.position = "none")

#Interpretation: May has the highest average of wind among six months.
#August has the lowest average of wind among six months.

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

library(ggplot2)
#histogram

ggplot(data = airquality, aes(x = Wind)) +
  geom_histogram(binwidth = 2, fill = "darkgreen", color = "green") +
  labs(title = "Wind Speed Distribution",
       x = "Wind Speed",
       y = "Frequency") + 
  theme_minimal()

##Interpretation: The highest frequency of the wind speed is 10.
##The lowest frequency of the wind speed is approximately 18.
##The wind speed distribution chart seem to show that the average of the wind speed is 10.

Including Plots

You can also embed plots, for example:

library(ggplot2)
#Facet Plot
ggplot(data = airquality, aes(x = Wind, y = Ozone)) +
  geom_point() +
  facet_wrap(~ factor(Month)) +
  labs(title = "Every Month of Wind Speed and Ozonoe Relationship",
       x = "Wind Speed",
       y = "Ozone") +
  theme_minimal()
## Warning: Removed 37 rows containing missing values or values outside the scale range
## (`geom_point()`).

##Interpretation: In July, it seems that wind speed and Ozone have negative relationships.
##In August, it seems that wind speed and Ozone have negative relationships.
##In May, Ozone doesn't go up to 50 no matter what the wind speed is. 

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

library(ggplot2)

ggplot(data = airquality, aes(x = factor(Month), y = Wind)) +
  geom_line(color = "blue") +
  labs(title = "Wind Speed by Month",
       x = "Month",
       y = "Wind Speed") +
  theme_minimal()

##Interpretation: June has the most vary wind speed among the six months
##Huly has the least vary wind speed among the six months.      
library(ggplot2)
#boxplot
ggplot(data = airquality, aes(x = factor(Month), y = Wind, fill = factor(Month))) +
  geom_boxplot() +
  labs(title = "Monthly by Wind",
       x = "Month",
       y = "Wind speed") +
  theme_minimal() +
  theme(legend.position = "none")

##intepretation:May shows the highest wind speed among the six months as the average of the wind speed is the highest as well.
##July shows the lowest wind speed among the six months as the average of the wind speed is the highest as well.