NikNakk / forestmodel

42 stars 13 forks source link

covariates option in forest_model do not work #19

Closed potentece closed 4 years ago

potentece commented 5 years ago

https://stackoverflow.com/questions/58341653/ggforest-survminer-only-selected-covariates

ShixiangWang commented 5 years ago

I have fixed, you can try the code

remotes::install_github("ShixiangWang/forestmodel")

library("forestmodel")
library("survival")
library("dplyr")
pretty_lung <- lung %>%
  transmute(time,
            status,
            Age = age,
            Sex = factor(sex, labels = c("Male", "Female")),
            ECOG = factor(lung$ph.ecog),
            `Meal Cal` = meal.cal)
print(forest_model(coxph(Surv(time, status) ~ ., pretty_lung), covariates=c("Age", "Sex")))

image

ShixiangWang commented 5 years ago

Please close it if it solves this issue.