## The following forms are equivalent:
scaleBy(conc+rate ~ state, data=Puromycin)
scaleBy(list(c("conc","rate"), "state"), data=Puromycin)
scaleBy(list(c("."), "."), data=Puromycin)
scaleBy(.~., data=Puromycin)
## The same results can be obtained from
lapply(splitBy(~state, data=Puromycin),
function(.dd) scale(.dd[,sapply(Puromycin,class)=="numeric"]))
## The pig growth data 'dietox'
data(dietox)
# "Remove the effect of time" by centering data within each time point.
dietox2 <- scaleBy(Weight~Time, data=dietox, scale=FALSE)
## Not run:
# library(lattice)
# xyplot(Weight~Time|Evit+Cu, groups=Pig, data=dietox)
# xyplot(Weight~Time|Evit+Cu, groups=Pig, data=dietox2)
# ## End(Not run)
Run the code above in your browser using DataLab