0

For my previous lines of code for making tables from column names, they successfully made short and dense matrices for me to readily process data from two questions (from survey results): (2nd example).

However, when I try using the same line of code (above), I don't get that sleek matrix. I end up getting a list of un-linked tables, which I do not want. Perhaps it's due to the new column only having 0's and 1's as numeric characters, vs. the others that have more than 2: (1st example).

[Please forgive my formatting issues (StackOverflow Status: Newbie). Also, many thanks in advance to those checking in on and answering my question!]

>table(select(data_final, `Relationship 2Affected Individual`, Satisfied_Treatments))
Relationship 2Affected Individual 1
           1                      0
           2                      0
           3                      0
           6                      0
           Other (please specify) 0

, , 1 = 1, Response = 10679308122

                                 0
Relationship 2Affected Individual 1
           1                      0
           2                      0
           3                      0
           6                      0
           Other (please specify) 0

, ,
...
> table(select(data_final, `Relationship 2Affected Individual`, Indirect_Benefits))
                                 Indirect_Benefits
Relationship 2Affected Individual  0  1  2  3
           1                       4  1  0  0
           2                      42 17  9  3
           3                      12  1  1  0
           6                       5  2  2  0
           Other (please specify)  1  0  0  0

>#rstudioapi::versionInfo() 

>#packageVersion("dplyr")
  • 2
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that we can copy/paste that can be used to test and verify possible solutions. – MrFlick Jun 10 '19 at 18:57

1 Answers1

0

table(data_final$Relationship 2Affected Individual, data_final$Satisfied_Treatments)

Problem Solved^

Community
  • 1
  • 1