-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot3.R
14 lines (14 loc) · 886 Bytes
/
plot3.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
NEI <- readRDS("summarySCC_PM25.rds")
SCC <- readRDS("Source_Classification_Code.rds")
# Of the four types of sources indicated by the type (point, nonpoint, onroad, nonroad) variable, which of these four sources have seen decreases in emissions from 1999-2008 for Baltimore City? Which have seen increases in emissions from 1999-2008? Use the ggplot2 plotting system to make a plot answer this question
library(ggplot2)
subsetNEI <- NEI[NEI$fips=="24510", ]
aggregatedTotalxYear <- aggregate(Emissions ~ year + type, subsetNEI, sum)
png("plot3.png", width=640, height=480)
g <- ggplot(aggregatedTotalxYear, aes(year, Emissions, color = type))
> g <- g + geom_line() +
+ xlab("year") +
+ ylab(expression('Total PM'[2.5]*" Emissions")) +
+ ggtitle('Total Emissions in Baltimore City, Maryland (fips == "24510") from 1999 to 2008')
> print(g)
> dev.off()