library(aqm)
data(sleep)
#str(sleep)
sleep$logBodyWt<-log10(sleep$BodyWt)
sleep$logBrainWt<-log10(sleep$BrainWt)
library(ggplot2)
library(plotly)
g0<-ggplot(sleep,aes(x=logBodyWt,y=logBrainWt, label=Species)) +geom_point(aes(colour=Diet)) +geom_smooth(method="lm")
ggplotly(g0)
mod<-lm(data=sleep,logBrainWt~logBodyWt)
sleep$bindex<-residuals(mod)
g2<-ggplot(sleep,aes(x=Diet,y=Sleep, label=Species))
g2+geom_boxplot()