I am trying to find Kaplan-Meier estimates for multiple variables.
I have a data.set which looks like this:
fw_year steroid_dos status current_dos
1 6.3271732 0.0 0 7.5-14.9 mg
24 4.5530457 0.0 0 no-use
29 0.9137577 0.0 0 no-use
33 7.3675566 367.5 0 15.0-24.9 mg
42 3.3127995 0.0 0 no-use
51 9.8288841 0.0 0 >0-4.9 mg
53 8.3696098 0.0 0 >0-4.9 mg
I used the code
fit1<-survfit(Surv_df ~ current_dos, data = df1)
to obtain the following results per category.
current_dos=no-use
time n.risk n.event survival std.err lower 95% CI upper 95% CI
21 480 1 0.998 0.00208 0.994 1.000
189 447 1 0.996 0.00305 0.990 1.000
203 444 1 0.993 0.00378 0.986 1.000
208 443 1 0.991 0.00438 0.983 1.000
my question is how can I do this to obtain kaplan-meier estimates for the drug categories to show results for every 1,5 and 10 years in the year column?