在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
> par(mfrow=c(2, 1)) > d <- density(mtcars$mpg) > > plot(d) > > d <- density(mtcars$mpg) > plot(d, main="kernel density of miles per gallon") > polygon(d, col="red", border="blue") > rug(mtcars$mpg, col="brown") > > par(lwd=2) > library(sm) > attach(mtcars) > > cyl.f <- factor(cyl, levels=c(4,6,8), + labels=c("4 cylinder", "6 cylinder", "8 cylinder")) > > sm.density.compare(mpg, cyl, xlab="miles per gallon") > title(main="MPG Distribution by Car Cylinders") > > colfill <- c(2:(1+length(levels(cyl.f)))) > legend(locator(1), levels(cyl.f), fill=colfill) > > detach(mtcars) >
|
请发表评论