Hello - I am using the following sample code to get distribution of patients with different lymph node (N stage) status in a given clinical dataset
prop.table(table(dataframe$Cohort=="A", dataframe$Nstage)) %>%
*
(100) %>% round(2)
I get a result which looks something like this:
However, I would like my results to add up to a 100% and not divided into False and True categories. The result I am looking for should appear like this (just an example):
0 1 2 Missing
20 60 20 0
Is there a way to edit the prop.table function in order to get this result?
Thanks!