服务热线
178 0020 3020
任务一
read.csv(file="F:/R学习作业/20171114/R2-2.1.csv", head=TRUE)
mydata<-read.csv(file="F:/R学习作业/20171114/R2-2.1.csv", head=TRUE)
library("ggplot2")
ggplot(data=mydata, aes(x=bwt, fill=factor(mydata$smoke)))+
geom_histogram(binwidth = 400,colour="black",position = "dodge")+
labs(x="birth weight",title="R2-17")+
scale_fill_discrete(h=c(0,200),c=400,name="Smoke",labels=c("no","yes"))
任务二
data(diamonds)
library(ggplot2)
ggplot(data=diamonds, aes(x=carat, color=color))+
geom_line(stat="density")+
xlab("price")+
ggtitle("R2-17")+
theme_bw()
附件