-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot3.R
More file actions
15 lines (15 loc) · 660 Bytes
/
plot3.R
File metadata and controls
15 lines (15 loc) · 660 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
plot3 <- function(...){
library(dplyr)
library(data.table)
library(ggplot2)
NEI <- readRDS("summarySCC_PM25.rds")
SCC <- readRDS("Source_Classification_Code.rds")
SCC$SCC <- as.character(SCC$SCC)
NEI_SCC <- left_join(NEI, SCC, by="SCC")
NEI_SCC <- data.table(NEI_SCC)
## Manipulate from main data table to subset
baltimorecity <- NEI_SCC[fips == "24510"]
qplot(year, Emissions, data=baltimorecity, facets=.~type, ylim=c(0,400), xlab="Observation Year in Baltimore City", ylab="Emissions Observations in Tons") + geom_smooth(method=lm)
## Crate plot file
ggsave("plot3.png", width=10, height=5)
}