This repository has been archived by the owner on Aug 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
123 lines (123 loc) · 3.92 KB
/
.Rhistory
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
heatmap
heatmap(iris)
?heatmap
require(graphics); require(grDevices)
x <- as.matrix(mtcars)
rc <- rainbow(nrow(x), start = 0, end = .3)
cc <- rainbow(ncol(x), start = 0, end = .3)
hv <- heatmap(x, col = cm.colors(256), scale = "column",
RowSideColors = rc, ColSideColors = cc, margins = c(5,10),
xlab = "specification variables", ylab = "Car Models",
main = "heatmap(<Mtcars data>, ..., scale = \"column\")")
utils::str(hv)
a <- rnorm(10000)
b <- rnorm(10000)
smoothScatter(a,b)
smoothScatter(a,b)
a <- rnorm(100000)
b <- rnorm(100000)
smoothScatter(a,b)
plot(a,b)
plot(a,b,col=rgb(0,0,0,0.5),pch=19)
plot(a,b,col=rgb(0,0,0,0.1),pch=19)
setwd("C:/Users/Administrator/Desktop/projects/RTry")
NEI <- readRDS("summarySCC_PM25.rds")
SCC <- readRDS("Source_Classification_Code.rds")
str(NEI)
plot(NEI$Emissions,NEI$year)
a <- data.frame(var1=c(1,2,3,4,5,6,7,8,9),var2=c(1,1,1,2,2,2,3,3,3))
a
a$var2 <- factor(a$var2)
a
a$var2
a$var1
tapplay(a$var1,a$var2,sum,simplify=T)
tapply(a$var1,a$var2,sum,simplify=T)
a
tapply(a$var1,a$var2,sum,simplify=F)
class(tapply(a$var1,a$var2,sum,simplify=T))
length(tapply(a$var1,a$var2,sum,simplify=T))
tapply(a$var1,a$var2,sum,simplify=T)[2]
str(NEI)
a <- data.frame(var1=c(1,2,3,4,5,6,7,8,9),var2=c(1,1,1,2,2,2,3,3,3))
tapply(a$var1,a$var2,sum,simplify=T)
tapply(a$var1,a$var2,sum)
PMayear <- tapply(NEI$Emissions,NEI$year,sum)
PMayear
plot(PMayear)
hist(PMayear)
PMayear <- tapply(NEI$Emissions,NEI$year,sum,simplify = F)
hist(PMayear)
PMayear <- tapply(NEI$Emissions,NEI$year,sum)
plot(PMayear,type="h")
plot(PMayear,type="s")
plot(PMayear,type="S")
plot(PMayear,type="l")
plot(PMayear,type="b")
plot(PMayear,type="c")
plot(PMayear,type="b")
?plot
plot(PMayear,c(1,2,3,4),type="b")
plot(c(1,2,3,4),PMayear,type="b")
plot(names(PMayear),PMayear,type="b")
plot(factor(names(PMayear)),PMayear,type="b")
plot(names(PMayear),PMayear,type="b")
plot(names(PMayear),PMayear,type="b",xlab="Year",ylab="PM2.5")
plot(names(PMayear),PMayear,type="b",xlab="Year",ylab="PM2.5",title="PM2.5 each year")
plot(names(PMayear),PMayear,type="b",xlab="Year",ylab="PM2.5")
title("PM2.5 each year")
?png
source("plot1.R")
plot1(NEI,SCC)
str(NEI)
str(SCC)
levels(NEI$fips)
NEI$fips
str(SCC)
head(SCC)
str(NEI)
Baltimore <- NEI[NEI$fips == "24510",]
Baltimore
source("plot2.R")
plot2(NEI,SCC)
?qplot()
?qplot
library(ggplot2)
?ggplot2
?qplot
qplot
?ggplot
str(Bal)
str(Baltimore)
qplot(year,Emissions,data=Baltimore,facets= . ~ type)
if(qplot){print(1)}
ddply
library(plyr)
ddply
qplot(year,sum(Emissions),data=Baltimore,facets= . ~ type)
qplot(year,Emissions,data=Baltimore,facets= . ~ type)
?aggregate
aggregate(Baltimore,by=Baltimore$year,fun=function(x){sum(x$Emissions)})
aggregate(Baltimore,by=Baltimore$year,FUN=function(x){sum(x$Emissions)})
aggregate(Baltimore,by="year",FUN=function(x){sum(x$Emissions)})
qplot(year,sum(Baltimore$Emissions),data=Baltimore,facets= . ~ type)
?aggregate
aggregate(Emissions ~ year + type,data = Baltimore,FUN=sum)
qplot(year,Emissions,data=Baltimore,facets= . ~ type)
PMperyearpertype <- aggregate(Emissions ~ year + type,data = Baltimore,FUN=sum)
qplot(year,Emissions,data=PMperyearpertype,facets= . ~ type)
qplot(year,Emissions,data=PMperyearpertype,facets= . ~ type,geom="density")
qplot(year,Emissions,data=PMperyearpertype,facets= . ~ type)
qplot(year,Emissions,data=PMperyearpertype,facets= . ~ type,title="PM2.5 of diffrent type in Baltimore")
qplot(year,Emissions,data=PMperyearpertype,facets= . ~ type,title="PM2.5 of diffrent type in Baltimore",geom="lines")
qplot(year,Emissions,data=PMperyearpertype,facets= . ~ type,title="PM2.5 of diffrent type in Baltimore",geom="line")
qplot(year,Emissions,data=PMperyearpertype,facets= . ~ type,title="PM2.5 of diffrent type in Baltimore",geom=c("point","line"))
qplot(year,Emissions,data=PMperyearpertype,facets= . ~ type,main="PM2.5 of diffrent type in Baltimore",geom=c("point","line"))
source("plot3.R")
plot3(NEI,SCC)
print
source("plot3")
source("plot3.R")
plot3(NEI,SCC)
source("plot3.R")
plot3(NEI,SCC)