An additional usage of the tidystats-produced file is that it can be read back into R and converted into a data frame. This enables researchers to then extract specific statistics to perform additional analyses with (e.g., meta-analyses). Below is an example.
# Load packages
library(tidystats)
library(dplyr)
# Read in a tidystats-produced .json file
results <- read_stats("results.json")
# Convert the list to a data frame
results_df <- tidy_stats_to_data_frame(results)
# Select the p-values
p_values <- filter(results_df, statistic == "p")
With the current example, this results in the following data frame:
identifier | method | group | term | statistic | value | type | preregistered |
---|---|---|---|---|---|---|---|
sleep_test | Paired t-test | p | 0.003 | primary | |||
lm_D9 | Linear regression | coefficients | (Intercept) | p | 0.000 | no | |
lm_D9 | Linear regression | coefficients | groupTrt | p | 0.249 | no | |
lm_D9 | Linear regression | model | p | 0.249 | no | ||
npk_aov | ANOVA | block | p | 0.016 | |||
npk_aov | ANOVA | N | p | 0.004 | |||
npk_aov | ANOVA | P | p | 0.475 | |||
npk_aov | ANOVA | K | p | 0.029 | |||
npk_aov | ANOVA | N:P | p | 0.263 | |||
npk_aov | ANOVA | N:K | p | 0.169 | |||
npk_aov | ANOVA | P:K | p | 0.863 |