-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot2.R
More file actions
17 lines (17 loc) · 692 Bytes
/
plot2.R
File metadata and controls
17 lines (17 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
plot2 <- function(...){
library(dplyr)
library(data.table)
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"]
totals <- baltimorecity[,.(Emissions.Sum=sum(Emissions)), by=year]
## Crate plot
png(filename="plot2.png")
## insert plot command here
barplot(totals$Emissions.Sum, names.arg=totals$year, xlab="Observation Year - Baltimore City", ylab="Total PM2.5 Emissions in Tons")
dev.off()
}