I want to calculate count of unique SUBJID according to severity so that it counts SUBJID only with higher grade severity using group by function of "dplyr" package. so that it will give out of grade 1 is 11 not 16 because grade 2 and grade 3 SUBJID are overlapping with grade 1.
i'm attaching images for the reference.
adae <- read.csv("C:/Studies/Rajat/X4/ADaM/ADaM/adae.csv")
ae=select(adae, SAFFL,TRTEMFL,SUBJID, AETOXGR,ASEV,AREL,RELCOMB,RELSTYPR);ae
a1=ae1 %>% group_by(AETOXGR) %>%
required output :
grade 1 11 34
grade 2 4 6
grade 3 1 1
Please help with this topic.