Hello, I was wondering if someone can help me prepare contingency table. I wish to have 'sample_name' in rows and words used in rows from first to fifth answer box in column. data file added here.
Here is code:
# reading data df <- read.csv("F:/first_comment_box_R.csv", stringsAsFactors = F) colnames(df) = "sample_name" newdf <- table(df$sample_name, df$first_box) contingency.table <- aggregate(df[-c(1,2)], list(product=df[, 1]), sum, na.rm=T) #> Error in FUN(X[[i]], ...): invalid 'type' (character) of argument
Created on 2020-05-22 by the reprex package (v0.3.0)