Skip to contents

Syntax sugar for $tidy_result and $raw_result elements of a glystats result object. It's useful to be used in pipes.

Usage

get_tidy_result(res, which = NULL)

get_raw_result(res, which = NULL)

Arguments

res

A glystats result object.

which

Used to specify which element to get, when the result is a list. If NULL, the whole result (tibble or list) will be returned.

Value

A tibble.

Examples

library(glyexp)
library(glyclean)
library(dplyr)
#> 
#> Attaching package: ‘dplyr’
#> The following object is masked from ‘package:glyexp’:
#> 
#>     select_var
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union

exp <- auto_clean(real_experiment) |>
  glyexp::slice_head_var(n = 10)
#>  Normalizing data (Median)
#>  Normalizing data (Median) [8ms]
#> 
#>  Removing variables with >50% missing values
#>  Removing variables with >50% missing values [16ms]
#> 
#>  Imputing missing values
#>  Sample size <= 30, using sample minimum imputation
#>  Imputing missing values

#>  Imputing missing values [16ms]
#> 
#>  Aggregating data
#>  Aggregating data [976ms]
#> 
#>  Normalizing data again
#>  Normalizing data again [16ms]
#> 

# Using a pipe
sig_res <- exp |>
  gly_anova() |>
  get_tidy_result("main_test") |>
  filter(p_adj < 0.05)
#>  Number of groups: 4
#>  Groups: "H", "M", "Y", and "C"
#>  Pairwise comparisons will be performed, with levels coming first as reference groups.

# Equivalent to
anova_res <- gly_anova(exp)
#>  Number of groups: 4
#>  Groups: "H", "M", "Y", and "C"
#>  Pairwise comparisons will be performed, with levels coming first as reference groups.
sig_res <- anova_res$tidy_result$main_test |>
  filter(p_adj < 0.05)