I am a beginner in working with R and need some help. Sorry if this question was answered before.
1) I have following data.frame
ID test
"1" "testA"
"1" "testB"
"2" "testA"
"2" "testB"
"3" "testA"
"4" "testB"
The data.frame
provides information on whether test A and/or test B was performed in test subjects
2) I would like to combine the individual rows with the same ID into one single row without losing the information in "test". This is the desired output:
ID testA testB
1 1 1
2 1 1
3 1 0
4 0 1
with 1 = yes
and 0 = no