tsum: Summarize a data.frame according to a given 'trial'

Description Usage Arguments Details Value Examples

View source: R/tsum.R

Description

Summarize data according to a 'trial' variable using either individual confidence intervals, model-based confidence intervals ('lm') or 'min-max'

Usage

1
2
3
4
5
6
7
8
9
tsum(
  x,
  var.names = c("y", "trial"),
  method = c("ici", "lm", "min-max"),
  level = 0.95,
  order = TRUE,
  add.id = TRUE,
  formula = NULL
)

Arguments

x

should be an object of class "data.frame"

var.names

names of variables 'y' (response) and 'trial' variable to summarize by.

method

'ici' individual confidence interval, 'lm' model-based confidence interval (with typical assumptions of a linear model), 'min-max' minimum and maximum values

level

coverage level with default 0.95

order

whether to order the summary by mean of response

add.id

whether to add the 'id' label

formula

alternative formula interface, if this is used 'var.names' is ignored.

Details

Custom function to summarize trial data

this function is for somewhat of narrow use case, but similar things can be accomplished using 'tidyverse' type operations. It uses 'aggregate'.

Value

a data.frame with the indicated summaries

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
## Summarize trial data
data(soyrs)
soyrs.s <- tsum(soyrs, var.names = c("lrr","Trial_ID")) 

ggplot(data = soyrs.s, aes(x = m, y = id)) + 
geom_point() + xlab("log RR") + ylab("ID") +
geom_vline(xintercept = 0)


## End(Not run)

femiguez/predintma documentation built on July 5, 2021, 4:16 a.m.