[[Rの備忘録]] > test1 <- data.frame(doc = rep("test1",3) , terms = c("A", "B", "C"), Freq = c(1,2,3)) > test2 <- data.frame(doc = rep("test2",3) , terms = c("A", "B", "D"), Freq = c(4,5,6)) > new.df <- rbind(test1, test2) > t(xtabs(Freq ~ ., data = new.df))