Learn R Programming

BuyseTest (version 3.0.5)

S4BuyseTest-plot: Graphical Display for GPC

Description

Graphical display of the percentage of favorable, unfavorable, neutral, and uninformative pairs per endpoint.

Usage

# S4 method for S4BuyseTest,ANY
plot(
  x,
  type = "hist",
  strata = "global",
  endpoint = NULL,
  label.strata = NULL,
  label.endpoint = NULL,
  plot = TRUE,
  color = c("#7CAE00", "#F8766D", "#C77CFF", "#00BFC4"),
  ...
)

Value

an invisible list containing the data and the ggplot object used for graphical display.

Arguments

x

an R object of class S4BuyseTest, i.e., output of BuyseTest

type

[character] type of plot: histogram ("hist"), pie chart ("pie"), or nested pie charts ("racetrack").

strata

[character vector] strata(s) relative to which the percentage should be displayed.

endpoint

[character vector] endpoint(s) relative to which the percentage should be displayed.

label.strata

[character vector] new labels for the strata levels. Should match the length of argument strata.

label.endpoint

[character vector] new labels for the endpoints. Should match the length of argument endpoint.

plot

[logical] should the graphic be displayed in a graphical window.

color

[character vector] colors used to display the percentages for each type of pair.

...

not used, for compatibility with the generic function.

Examples

Run this code
if(require(ggplot2)){

## simulate data
set.seed(10)
df.data <- simBuyseTest(1e2, n.strata = 2)

ff1 <- treatment ~ bin(toxicity) + TTE(eventtime, status = status,
                                      restriction = 1, threshold = 0.5)
BT1 <- BuyseTest(ff1, data= df.data)
plot(BT1, type = "hist")
plot(BT1, type = "pie")
plot(BT1, type = "racetrack")

ff2 <- update(ff1, ~.+cont(score))
BT2 <- BuyseTest(ff2, data= df.data)
plot(BT2, type = "hist")
plot(BT2, type = "pie")
plot(BT2, type = "racetrack")

}

Run the code above in your browser using DataLab