Function returns significance stars for p-values, most likely for use in tables that report the results of multiple statistical tests. An empty string is returned for NAs, unless that behaviour is overwritten.
sigstars(p, stars = NULL, pad_html = FALSE, ns = FALSE, return_NAs = FALSE)
Adapted from http://www.sthda.com/english/wiki/elegant-correlation-table-using-xtable-r-package
A p-value or (more commonly) a vector of p-values
A character vector to change the significance symbols (see details below)
Should all results be padded right to the same width with HTML non-breaking spaces?
Logical. Should non-significant values be highlighted as "ns"?
Logical. Should NAs be returned? If not, empty strings are returned instead.
A character vector of significance stars for each p-value, each padded with spaces to be four characters long
Symbols and thresholds are *** p < .001, ** p < .01, * p
< .05 and † p < .1. The symbols can be changed by passing a named character vector sorted
descendingly to the stars
argument. For the default, the argument would be
stars <- c(
†= .1,
= 0.05,
= 0.01,
= 0.001)