Learn R Programming

rpact (version 2.0.6)

plot.Dataset: Dataset Plotting

Description

Plots a dataset.

Usage

# S3 method for Dataset
plot(
  x,
  y,
  ...,
  main = "Dataset",
  xlab = "Stage",
  ylab = NA_character_,
  legendTitle = "Group",
  palette = "Set1",
  showSource = FALSE
)

Arguments

x

The Dataset object to plot.

y

Not available for this kind of plot (is only defined to be compatible to the generic plot function).

...

Optional ggplot2 arguments.

main

The main title, default is "Dataset".

xlab

The x-axis label, default is "Stage".

ylab

The y-axis label.

legendTitle

The legend title, default is "Group".

palette

The palette, default is "Set1".

showSource

If TRUE, the parameter names of the object will be printed which were used to create the plot; that may be, e.g., useful to check the values or to create own plots with plot.

Value

A ggplot2 object.

Details

Generic function to plot all kinds of datasets.

Examples

Run this code
# NOT RUN {
# Plot a dataset of means
dataExample <- getDataset(
    n1 = c(22, 11, 22, 11),
    n2 = c(22, 13, 22, 13),
    means1 = c(1, 1.1, 1, 1),
    means2 = c(1.4, 1.5, 3, 2.5),
    stDevs1 = c(1, 2, 2, 1.3),
    stDevs2 = c(1, 2, 2, 1.3))

if (require(ggplot2)) plot(dataExample, main = "Comparison of means")

# Plot a dataset of rates
dataExample <- getDataset(
    n1 = c(8, 10, 9, 11),
    n2 = c(11, 13, 12, 13),
    events1 = c(3, 5, 5, 6),
    events2 = c(8, 10, 12, 12)
)

if (require(ggplot2)) plot(dataExample, main = "Comparison of rates")

# }

Run the code above in your browser using DataLab