@Macux
2015-12-01T06:46:18.000000Z
字数 851
阅读 976
R语言_学习笔记
> ggplot(faithful,aes(eruptions,waiting)) + geom_point(color="skyblue") + geom_rug(position="jitter",size=0.2,color="darkorange3")
> cdat <- subset(countries,Year==2009 & Name %in% c("Canada","Ireland","United Kingdom","New Zealand","Iceland","Japan","Luxembourg","Netherlands","Switzerland"))
> ggplot(cdat,aes(healthexp,infmortality)) + geom_point(aes(size=GDP),shape=21,color="black",fill="cornsilk") + scale_size_area(max_size=12)
> library(plyr)
> library(MASS)
> birthwt$smoke <- revalue(factor(birthwt$smoke),c("0"="No Smoke","1"="Smoke"))
> ggplot(birthwt,aes(bwt,..density..)) + geom_histogram(binwidth=200,fill="cornsilk",color="gray60",size=0.2) + geom_density() + facet_grid(smoke~.,space="free")
-What can revalue function do for us?
-Replace specified values with new values, in a factor or character vector.