Description Usage Arguments Examples
View source: R/30-nightingale_rose.R
This function produces a nightingale plot with a binary response.
1 2 3 4 5 6 7 8 9 10 11 12 |
dat |
a data set |
covari.sel |
a vector of indices of the two covariates |
trt.sel |
a covariate index specifying the treatment code |
resp.sel |
a covariate index specifying the response variable |
outcome.type |
a string specifying the type of the response variable, it can be "continuous", or "binary" or "survival". |
seq_by |
a number specifying the breaks in the y-axis |
title |
a string specifying the main title. |
lab.y |
a character value specifying the label of the y axis |
strip |
title for the legend |
palette_colors |
the colors for the graphics, a two character vector. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | library(dplyr)
dat <- prca
levels(dat$age_group) = c("Young","Middle-aged","Old")
levels(dat$weight_group) = c("Low","Mid","High")
comb_levels = c("Young - Low", "Young - Mid", "Young - High",
"Middle-aged - Low", "Middle-aged - Mid", "Middle-aged - High",
"Old - Low", "Old - Mid", "Old - High")
dat %>%
mutate(AgeWeight = factor(sprintf("%s - %s", age_group, weight_group),
levels = comb_levels)) %>%
mutate(survival = factor(ifelse(survtime > 24 , "Yes", "No"),
levels = c("No", "Yes"))) %>%
mutate(rx = factor(rx, labels = c("Control", "Treatment"))) -> dat
plot_nightingale(dat = dat, covari.sel = 16, resp.sel = 17,
strip = "2-year survival")
plot_nightingale(dat = dat, trt.sel = 3, covari.sel = 16,
resp.sel = 17,
seq_by = 50,
strip = "2-year survival")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.