NEI <- readRDS("summarySCC_PM25.rds")
SCC <- readRDS("Source_Classification_Code.rds")
library(plyr)
library(ggplot2)
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following objects are masked from 'package:plyr':
##
## arrange, mutate, rename, summarise
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
Including Plots
# Subset data and plot
baltimoreNEI <- subset(NEI, NEI$fips == "24510")
plot_data <- ddply(baltimoreNEI, .(year, type), numcolwise(sum))
head(plot_data)
## year type Emissions
## 1 1999 NON-ROAD 522.9400
## 2 1999 NONPOINT 2107.6250
## 3 1999 ON-ROAD 346.8200
## 4 1999 POINT 296.7950
## 5 2002 NON-ROAD 240.8469
## 6 2002 NONPOINT 1509.5000
plot_ly(plot_data, x = ~year, y = ~Emissions, z = ~type) %>%
add_markers(color = ~type)