# Round and format a vector of p-values
# ::::::::::::::::::::::::::::::::::::::::::::
# Format
p <- c(0.5678, 0.127, 0.045, 0.011, 0.009, 0.00002, NA)
p_format(p)
# Specify the accuracy
p_format(p, accuracy = 0.01)
# Add p and remove the leading zero
p_format(p, add.p = TRUE, leading.zero = FALSE)
# Remove space before and after "=" or "<".
p_format(p, add.p = TRUE, leading.zero = FALSE, space = FALSE)
# Mark significant p-values
# ::::::::::::::::::::::::::::::::::::::::::::
p_mark_significant(p)
# Round, the mark significant
p %>% p_round(digits = 2) %>% p_mark_significant()
# Format, then mark significant
p %>% p_format(digits = 2) %>% p_mark_significant()
# Perform stat test, format p and mark significant
# ::::::::::::::::::::::::::::::::::::::::::::
ToothGrowth %>%
group_by(dose) %>%
t_test(len ~ supp) %>%
p_format(digits = 2, leading.zero = FALSE) %>%
p_mark_significant()
Run the code above in your browser using DataLab