rsimsum and the tidyverse

options(width = 150)
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.align = "center", fig.height = 6, fig.width = 6,
  out.width = "75%"
)

rsimsum plays nice with the tidyverse.

library(rsimsum)
library(dplyr)
library(ggplot2)
library(knitr)

For instance, it is possible to chain functions using the piping operator %>% to obtain tables and plots with a single call:

data("MIsim", package = "rsimsum")
MIsim %>%
  simsum(estvarname = "b", se = "se", methodvar = "method", true = 0.5) %>%
  summary() %>%
  tidy() %>%
  kable()
MIsim %>%
  simsum(estvarname = "b", se = "se", methodvar = "method", true = 0.5) %>%
  summary() %>%
  tidy(stats = "bias") %>%
  ggplot(aes(x = method, y = est, ymin = lower, ymax = upper)) +
  geom_hline(yintercept = 0, color = "red", lty = "dashed") +
  geom_point() +
  geom_errorbar(width = 1 / 3) +
  theme_bw() +
  labs(x = "Method", y = "Bias")


Try the rsimsum package in your browser

Any scripts or data that you put into this service are public.

rsimsum documentation built on May 21, 2021, 5:06 p.m.