pd_methods: Print, plot, and subset PDRobust results

print.pd_mappingR Documentation

Print, plot, and subset PDRobust results

Description

Provides standard ways to print analysis summaries, draw stored plots, and select rows or columns from data prepared by DataStandard(). Plotting a result does not refit its model.

Usage

## S3 method for class 'pd_mapping'
print(x, ...)

## S3 method for class 'pd_data_check'
print(x, ...)

## S3 method for class 'pd_data'
x[...]

## S3 method for class 'pd_hte_timevarying'
print(x, ...)

## S3 method for class 'pd_hte_pooled'
print(x, ...)

## S3 method for class 'PSDiag'
print(x, ...)

## S3 method for class 'PrinSDiag'
print(x, ...)

## S3 method for class 'odds_ratios'
print(x, ...)

## S3 method for class 'QR'
print(x, ...)

## S3 method for class 'SA'
print(x, ...)

## S3 method for class 'pd_hte_timevarying'
plot(x, ...)

## S3 method for class 'pd_hte_pooled'
plot(x, ...)

## S3 method for class 'PSDiag'
plot(x, ...)

## S3 method for class 'PrinSDiag'
plot(x, ...)

## S3 method for class 'odds_ratios'
plot(x, ...)

Arguments

x

An object returned by a PDRobust function. For [, this must be a data frame returned by DataStandard().

...

For subsetting, arguments passed to the next [ method, including row and column indices and drop. For printing and plotting, additional arguments are accepted for generic compatibility but ignored.

Details

Subsetting preserves the stored information but does not check the data again. Before analyzing subsetted or edited data, validate them because removing rows or columns can break the required longitudinal structure. QR() has a print method but no package-specific plot method.

Value

Print methods show the main result and invisibly return x. When a result contains a plot, printing also draws it; SA draws all stored sensitivity plots. Plot methods invisibly return the stored ggplot object. Subsetting returns the selected data and preserves its PDRobust mapping and preparation information when the result remains a data frame.

Examples

data("BiSample", package = "PDRobust")
map <- Mapping(
  id = "id", time = "time", treatment = "A", survival = "S", outcome = "Y",
  baseline_time = 0, cutoff_time = 2,
  covariates = c("X1", "X2", "X4"),
  interest_vars = c("X1", "X2"), y_type = "B"
)
print(map)
print(DataCheck(BiSample, map))
prepared <- DataStandard(BiSample, map)
prepared[1:3, ]
diagnostic <- PSDiag(prepared, A ~ X1 + X2 + X4)
print(diagnostic)
p <- plot(diagnostic)

PDRobust documentation built on Oct. 2, 2026, 5:09 p.m.