-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Plot 1 -> done - Plot 2 -> done
- Loading branch information
Showing
6 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# ExData_Plotting2 | ||
Plotting Assignment 1 for Exploratory Data Analysis | ||
Plotting Assignment 2 for Exploratory Data Analysis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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() |