[R] Assembling output of table()

Sumitrajit Dhar s-dhar at northwestern.edu
Tue Apr 7 16:47:31 CEST 2015


Hi folks,

I am struggling with something that should be simple.

Here is my data frame:
head(jData[,1:8])
  x study_id qx_1_v4j qx_1a_v4j qx_1b_v4j qx_2_v4j qx_2a_v4j qx_3_v4j
1 1  MCJ1001        1         1         1        1         1        1
2 2  MCJ1002        1         1         2        1         2        0
3 3  MCJ1003        1         1         1        0        NA        1
4 4  MCJ1004        1         1         2        1         3        0
5 5  MCJ1005        1         1         1        1         1        1
6 6  MCJ1006        1         1         0        1         3        0


I want to run table() on each of the columns and compile the results into a single list/table/whatever works with the first column being the column name. The resulting output will have different numbers of columns per row.

Is this possible?

Regards, 
Sumit



More information about the R-help mailing list