Hi,
I have survival data from about 100 patients. I would like to divide my cohort into 2 groups: a group of 50% of the best surviving patients and a group of 50% of the worst surviving patients. How do I do this?
Thanks
Alex
Hi,
I have survival data from about 100 patients. I would like to divide my cohort into 2 groups: a group of 50% of the best surviving patients and a group of 50% of the worst surviving patients. How do I do this?
Thanks
Alex
Create a new column in your dataset, and code them either 0 or 1.
So, for example, taking a simplified data frame consisting of single numeric variable
set.seed(42)
dat <- data.frame(score = sample(1:100,100,replace = TRUE))
dat$category <- ifelse(dat$score < median(dat$score),0,1)
head(dat)
#> score category
#> 1 49 1
#> 2 65 1
#> 3 25 0
#> 4 74 1
#> 5 100 1
#> 6 18 0
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.