Description Usage Arguments Examples
View source: R/26-circular-plot-function.r
This function produces a circular plot for subgroup analysis using the circlize package. Overlaps across all variable levels are displayed in a single diagram.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | plot_circle(
dat,
covari.sel,
trt.sel,
resp.sel,
outcome.type,
range.v = NULL,
adj.ann.subgrp = 4,
range.strip = c(-3, 3),
n.brk = 31,
n.brk.axis = NULL,
font.size = c(1, 1, 0.85, 0.85, 1),
title = NULL,
lab.xy = NULL,
strip = "Treatment effect size",
effect = "HR",
equal.width = TRUE,
show.KM = FALSE,
show.effect = TRUE,
conf.int = TRUE,
show.overall = TRUE,
palette = "divergent",
col.power = 0.5
)
|
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". |
range.v |
a vector specifying the vertical range of graphical display. |
adj.ann.subgrp |
a parameter adjusting the distance between a point and its corresponding subgroup label. The smaller the value is, the larger the distance is. |
range.strip |
a vector with two elements specifying the range of treatment effect size for display |
n.brk |
a number specifying the number of the points dividing the range of the argument "range.strip". |
n.brk.axis |
a number specifying the number of breakpoints dividing the axis of the argument "range.strip". |
font.size |
a vector specifying the size of labels and text; the first element is for the main title, the second is for for x-axis and y-axis labels; the thrid is for the legend text of subgroups; the fourth is for the subgroup labels near points; the fifth is for the unit labels on all the axes. |
title |
a string specifying the main title. |
lab.xy |
a list of two strings specifying the labels of the x and y axes. |
strip |
a string specifying the title of the colour strip. |
effect |
either "HR" or "RMST". only when outcome.type = "survival" |
equal.width |
A logical indicating whether the sectors should have equal width or proportional to their sample sizes |
show.KM |
A logical indicating whether to show the Kaplan-Meier curves for the subgroups |
show.effect |
A logical indicating whether to show the treatment effect |
conf.int |
A logical indicating whether to show confidence intervals for the treatment effect. |
show.overall |
A logical indicating whether to show the overall treatment effect and its confidence intervals in the reference strip |
palette |
either "divergent" or "hcl" |
col.power |
to be used when palette = "hcl". see colorspace package for reference |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | library(dplyr)
# Load the data to be used
data(prca)
dat <- prca
vars = data.frame(variable = names(dat), index = 1:length(names(dat)))
levels(dat$age_group) = c("Young","Middle-aged","Old")
levels(dat$weight_group) = c("Low","Mid","High")
dat %>%
rename(Age= age_group,
Weight = weight_group)-> dat
set.seed(55643)
plot_circle(dat,
covari.sel = c(14, 15),
trt.sel = 3,
resp.sel = c(1, 2),
outcome.type = "survival",
range.v = NULL, adj.ann.subgrp = 4,
range.strip=c(-3, 3),
n.brk = 31,
n.brk.axis = 7,
font.size = c(1, 1, 0.85, 0.85, 1),
title = NULL, lab.xy = NULL,
strip = "Treatment effect size (log hazard ratio)",
effect = "HR",
equal.width = FALSE,
show.KM = FALSE,
show.effect = TRUE,
conf.int = FALSE, palette = "hcl")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.