inst/doc/reusing-statistics.R

## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----echo = FALSE-------------------------------------------------------------
library(knitr)
options(knitr.kable.NA = "-")

## ----results = "hide", message = FALSE----------------------------------------
# Load packages
library(tidystats)
library(dplyr)

# Read the .json file containing the statistics and immediately convert it to
# a data frame
statistics <- read_stats("statistics.json") |>
  tidy_stats_to_data_frame()

# Extract all the p-values
p_values <- filter(statistics, statistic_name == "p")

p_values

## ----echo = FALSE-------------------------------------------------------------
kable(p_values, format = "markdown")

## -----------------------------------------------------------------------------
sig_p_values <- filter(statistics, statistic_name == "p" & value < .05)

## ----example2_eval, echo = FALSE----------------------------------------------
kable(sig_p_values, format = "markdown")

Try the tidystats package in your browser

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

tidystats documentation built on Oct. 17, 2023, 1:06 a.m.