-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot2.R
More file actions
32 lines (23 loc) · 718 Bytes
/
Copy pathplot2.R
File metadata and controls
32 lines (23 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Check if we have data, if not load it!
source("load.data.R")
if (!exists("MEI")) {
NEI <- load.NEI()
}
if (!exists("SCC")) {
SCC <- load.SCC()
}
# Have total emissions from PM2.5 decreased in the Baltimore City, Maryland (fips == "24510")
# from 1999 to 2008? Use the base plotting system to make a plot answering this question.
library(dplyr)
png('plot2.png', width=750, height=750)
with(
NEI %>%
filter(fips == "24510") %>%
group_by(year) %>%
summarise(emissions = sum(Emissions)),
plot(year, emissions, type = "l",
main = "Fine particulate matter emissions (PM2.5) in Baltimore City, Maryland",
xlab = "Year",
ylab = "Total emissions in tons")
)
dev.off()