I have a somewhat simple question (i think), but can't seem to find a solution. I would like to create a new dataframe that groups and sums multiple variables.
My data:
ID  Test    result  ped adult
AB  a   0   0   1
AB  b   1   0   1
FM  a   1   1   0
FM  c   0   1   0
WD  a   0   0   1
WD  b   1   0   1
WD  c   0   0   1
WD  d   1   0   1
WD  a   0   0   1
WD  a   1   0   1
The output I would like:
Test    No of ID's test with test performed     No of ID's positive     ped adult
a   3   2   1   1
b   2   2   0   2
c   2   0   0   0
d   1   1   0   1
I have tried using aggregate and dplyr using group_by and sum, but have not had success.
NB: edited to add ped and adult columns. I would like to sum the positive tests and then have a sum for ped and adult positive tests.
 
    