iris_ <- sample(iris,size=nrow(iris),replace=TRUE)
w <- rep(1,nrow(iris_))
contract(iris[4:5])
contract(iris[4:5],sort=TRUE)
contract(iris[4:5],weights=w,sort=TRUE)
contract(iris,by=c(Petal.Width,Species),sort=TRUE)
contract(iris,by=~Petal.Width+Species)
contract(iris,by=w~Species)
library(MASS)
contract(housing,
by=Sat~Infl+Type+Cont,
weights=Freq)
contract(housing,
by=Sat~Infl+Type+Cont,
weights=Freq,
name="housing",force.name=TRUE
)
Run the code above in your browser using DataLab