Please help and review.
Using dataset msleep, plot a qplot against bodywt and sleep_total factors, and add a line using geo_smooth. Use qplot to draw a line applying a linear regression model to remove the standard error. Group by vore. Separate the model into multi-facets by vore.
names(msleep):"name" "genus" "vore" "order" "conservation" "sleep_total" "sleep_rem" "sleep_cycle" "awake" "brainwt" "bodywt"
***
qplot(log(bodywt),sleep_total,data=msleep)+geom_smooth()
qplot(log(bodywt),sleep_total,data=msleep)+geom_smooth(method = "lm",se=F)
qplot(log(bodywt),sleep_total,data=msleep,color=vore)+geom_smooth(method = "lm",se=F)
qplot(log(bodywt),sleep_total,data=msleep)+geom_smooth(method = "lm",se=F)+facet_grid(.~vore)
You can use ggplot
like
library(ggplot2)
ggplot(msleep, aes(x = log(bodywt), y= sleep_total))+
geom_point()+
geom_smooth(method = "lm",se=F)+facet_grid(.~vore, scales = "free")
ggplot(msleep, aes(x = log(bodywt), y= sleep_total, color=vore))+
geom_point()+
geom_smooth(method = "lm",se=F)