Skip to content
Advertisement

Calculating the percentage of an outcome per group

Have a data frame of a predictive model output that is seperated into tertiles (low, medium, and high risk). I want to calculate the percentage of people in each risk zone that have the outcome of interest.

JavaScript

theoretical desired output is a dataframe that has

JavaScript

Advertisement

Answer

Use:

JavaScript
Advertisement