The data used for the plots in these exercises is from the dataset Temperature.csv

temp = read.csv("Temperature.csv")

The ggplot() package is added into the markdown

library(ggplot2)

Use ggplot() to produce a histogram of salinity values

salplot = ggplot(temp, aes(x=Salinity))
salplot = salplot + geom_histogram(binwidth=1)
salplot
## Warning: Removed 798 rows containing non-finite outside the scale range
## (`stat_bin()`).

Make a histogram of salinity values for (1) each year of study

sal_year = ggplot(temp, aes(x=Salinity))
sal_year = sal_year + geom_histogram(binwidth=1) + facet_grid(~ Year)
sal_year
## Warning: Removed 798 rows containing non-finite outside the scale range
## (`stat_bin()`).

and (2) each month of study

sal_month = ggplot(temp, aes(x=Salinity))
sal_month = sal_month + geom_histogram(binwidth=1) + facet_grid(~ Month)
sal_month
## Warning: Removed 798 rows containing non-finite outside the scale range
## (`stat_bin()`).

Make a boxplot of temperature values for each station

tempbox = ggplot(temp, aes(x=Station, y=Temperature))
tempbox = tempbox + geom_boxplot()
tempbox
## Warning: Removed 927 rows containing non-finite outside the scale range
## (`stat_boxplot()`).

Save the last figure to a png file

ggsave("box_tempvsstation.png", tempbox)
## Saving 7 x 5 in image
## Warning: Removed 927 rows containing non-finite outside the scale range
## (`stat_boxplot()`).