Col1 has ID, Col2, Col3, Col4 has different questions with Yes and No answer. I am trying to output number of yes and no in each column. This is for spotfire(r) table. I tried using pivot_wider function, but it didnt work for more than one column.
Thanks for looking into this.
ID | Q1 | Q2 |
---|---|---|
101 | Yes | No |
104 | Yes | Yes |
104 | No | No |
Q1 - Yes | Q1 - No | Q2-Yes | Q2 - No |
---|---|---|---|
2 | 1 | 1 | 2 |
A base R option
gives
data