Aggregating factor level counts - by factor
问题 I have been trying to make a table displaying the counts of factor levels by another factor. For this, I looked on dozens of pages, questions... trying to use functions in some packages (dplyr, reshape) to get the job done, without any success in using them correctly. That's what I got: # my data: var1 <- c("red","blue","red","blue","red","red","red","red","red","red","red","red","blue","red","blue") var2 <- c("0","1","0","0","0","0","0","0","0","0","1","0","0","0","0") var3 <- c("2","2","1",