merge_tables {lazy.tools} | R Documentation |
Merge Tables or Frequency Distributions of the form (score, freq)
merge_tables(..., omitmiss = 0)
... |
tables, matrices or data.frames containing frequency distribution |
omitmiss |
= 1 to remove zero-frequency cells |
Each of ... can be a class table object created by native table or xtabs,
or a data.frame or matrix containing the level-index and frequency.
Each of ... should have the same # of factors to be tabulated.
A frequency distribution of the form (x,freq)
set.seed(1701)
x <- sample(1:8,10,replace=1); x <- c(x,c(1,1,7)); xc <- paste("x",x,sep="")
y <- sample(0:9,10,replace=1); y <- c(y,c(5,5,0)); yc <- paste("y",y,sep="")
# univariate example
rest11 <- table( x )
rest12 <- rest11[-c(1,3)]
resm <- merge_tables( rest11, rest12 )
plot_freqdist( resm )
# bivariate example
rest2 <- table( x, y )
fd21 <- table2freqdist( rest2, omitmiss=1, index=1 )
fd22 <- fd21[-c(1,10),]
merge_tables( rest2, fd21, fd22, omitmiss=1 )