Sorry about the simple question. Is there any function to transform a data.frame like this (rows are observations and columns are variables):
Q1_1 Q1_2 Q1_3 Q1_4 Q1_5 Q1_6 Q1_7 Q1_8 1 5 5 5 4 5 4 5 4 2 4 5 3 5 5 5 3 5 3 4 4 3 4 4 4 4 2 4 5 5 5 5 5 4 4 4 5 5 5 5 5 5 5 5 5 6 3 4 4 3 3 3 4 0 7 4 3 4 4 0 4 5 0 8 2 2 3 1 2 1 1 1 Into a data.frame where the rows are the columns of the previous one and each column is a possible value for that variable. The data are the counting of observations for each variable vs possible value: 1 2 3 4 5 Q1_1 0 1 1 3 3 Q1_2 0 1 1 2 4 ... I know that I can use: tapply(x[["Q1_1"]],factor(x[["Q1_1"]], levels=1:5), length) to compute each row and than create a matrix of it. But I wonder if there is some function already defined for doing this transformation. Cheers, Alexandre ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.