
Last chance! 50% off unlimited learning
Sale ends in
rectangularize
produces a complete rectangularization table by adding observations with missing data so that all combinations (interactions) of the specified variables exist.rectangularize(x, by, fill = NA)
fill = 0
.x
.data <- data.frame(sex=c("female","male","male"),
race = c("black","black","white"), y = c(.5,.4,.1), x = c(32,40,53))
rectangularize(data, by=c(sex,race))
rectangularize(data, by=c(sex,race), fill=0)
Run the code above in your browser using DataLab