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")
head(adae)
ae=select(adae, SAFFL,TRTEMFL,SUBJID, AETOXGR,ASEV,AREL,RELCOMB,RELSTYPR);ae
ae1=filter(ae,SAFFL=="Y" );ae1
a1=ae1 %>% group_by(AETOXGR) %>%
summarise(N=length(unique(SUBJID)), E=length(SUBJID))
View(a1)
required output :
N E
grade 1 11 34
grade 2 4 6
grade 3 1 1
Please help with this topic.