combplotp | R Documentation |
Generates a plotly attribute plot given a series of possibly overlapping binary variables
combplotp(
formula,
data = NULL,
subset,
na.action = na.retain,
vnames = c("labels", "names"),
includenone = FALSE,
showno = FALSE,
maxcomb = NULL,
minfreq = NULL,
N = NULL,
pos = function(x) 1 * (tolower(x) %in% c("true", "yes", "y", "positive", "+",
"present", "1")),
obsname = "subjects",
ptsize = 35,
width = NULL,
height = NULL,
...
)
formula |
a formula containing all the variables to be cross-tabulated, on the formula's right hand side. There is no left hand side variable. If |
data |
input data frame. If none is specified the data are assumed to come from the parent frame. |
subset |
an optional subsetting expression applied to |
na.action |
see |
vnames |
set to |
includenone |
set to |
showno |
set to |
maxcomb |
maximum number of combinations to display |
minfreq |
if specified, any combination having a frequency less than this will be omitted from the display |
N |
set to an integer to override the global denominator, instead of using the number of rows in the data |
pos |
a function of vector returning a logical vector with |
obsname |
character string noun describing observations, default is |
ptsize |
point size, defaults to 35 |
width |
width of |
height |
height of |
... |
optional arguments to pass to |
Similar to the UpSetR
package, draws a special dot chart sometimes called an attribute plot that depicts all possible combination of the binary variables. By default a positive value, indicating that a certain condition pertains for a subject, is any of logical TRUE
, numeric 1, "yes"
, "y"
, "positive"
, "+"
or "present"
value, and all others are considered negative. The user can override this determination by specifying her own pos
function. Case is ignored in the variable values.
The plot uses solid dots arranged in a vertical line to indicate which combination of conditions is being considered. Frequencies of all possible combinations are shown above the dot chart. Marginal frequencies of positive values for the input variables are shown to the left of the dot chart. More information for all three of these component symbols is provided in hover text.
Variables are sorted in descending order of marginal frqeuencies and likewise for combinations of variables.
plotly
object
Frank Harrell
if (requireNamespace("plotly")) {
g <- function() sample(0:1, n, prob=c(1 - p, p), replace=TRUE)
set.seed(2); n <- 100; p <- 0.5
x1 <- g(); label(x1) <- 'A long label for x1 that describes it'
x2 <- g()
x3 <- g(); label(x3) <- 'This is<br>a label for x3'
x4 <- g()
combplotp(~ x1 + x2 + x3 + x4, showno=TRUE, includenone=TRUE)
n <- 1500; p <- 0.05
pain <- g()
anxiety <- g()
depression <- g()
soreness <- g()
numbness <- g()
tiredness <- g()
sleepiness <- g()
combplotp(~ pain + anxiety + depression + soreness + numbness +
tiredness + sleepiness, showno=TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.