Filter out non-significant (NS) p-values from a statistical test. Can detect automatically p-value columns

remove_ns(stat.test, col = NULL, signif.cutoff = 0.05)

Arguments

stat.test

statistical test results returned by rstatix functions or any data frame containing a p-value column.

col

(optional) character specifying the column containing the p-value or the significance information, to be used for the filtering step. Possible values include: "p", "p.adj", "p.signif", "p.adj.signif". If missing, the function will automatically look for p.adj.signif, p.adj, p.signif, p in this order.

signif.cutoff

the significance cutoff; default is 0.05. Significance is declared at p-value <= signif.cutoff

Value

a data frame

Examples

# Statistical test
stat.test <- PlantGrowth %>% wilcox_test(weight ~ group)
# Remove ns: automatic detection of p-value columns
stat.test %>% remove_ns()
#> # A tibble: 1 × 9
#>   .y.    group1 group2    n1    n2 statistic     p p.adj p.adj.signif
#>   <chr>  <chr>  <chr>  <int> <int>     <dbl> <dbl> <dbl> <chr>       
#> 1 weight trt1   trt2      10    10        16 0.009 0.027 *           
# Remove ns by the column p
stat.test %>% remove_ns(col ="p")
#> # A tibble: 1 × 9
#>   .y.    group1 group2    n1    n2 statistic     p p.adj p.adj.signif
#>   <chr>  <chr>  <chr>  <int> <int>     <dbl> <dbl> <dbl> <chr>       
#> 1 weight trt1   trt2      10    10        16 0.009 0.027 *