-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot 2.R
More file actions
24 lines (16 loc) · 967 Bytes
/
plot 2.R
File metadata and controls
24 lines (16 loc) · 967 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
dir()
setwd("E:/R Programming/R Coursera/Exploratory Data Analysis/Week 4")
## Loading Data SummarySCC.RDS
if(!exists("NEI"))
NEI <- readRDS("E:/R Programming/R Coursera/Exploratory Data Analysis/Week 4/summarySCC_PM25.rds")
if(!exists("SCC"))
SCC <- readRDS("E:/R Programming/R Coursera/Exploratory Data Analysis/Week 4/Source_Classification_Code.rds")
## 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.
names(SCC)
names(NEI)
subsetBaltimore <- subset(NEI, fips == "24510")
totalbyYearBaltimore <- aggregate(Emissions ~ year, subsetBaltimore, sum)
png('plot2.png')
barplot(height=totalbyYearBaltimore$Emissions, names.arg=totalbyYearBaltimore$year, xlab="years", ylab=expression('total PM'[2.5]*' emission'),main=expression('Total PM'[2.5]*' emissions at various years in Baltimore'))
dev.off()