Skip to content

Instantly share code, notes, and snippets.

@ljcolling
Created January 4, 2018 13:01
Show Gist options
  • Select an option

  • Save ljcolling/efadbbbef31dced44d978f3bba7f890c to your computer and use it in GitHub Desktop.

Select an option

Save ljcolling/efadbbbef31dced44d978f3bba7f890c to your computer and use it in GitHub Desktop.
Simple one-liner for formatting p-values in r
# This example takes the p value for a aov structure, but it can be modified for work with anything
unname(ifelse(aov[[1]][row.index,][[p.index]] > 0.001,
paste("*p* =",str_trunc(sprintf("%.3f",unname(aov[[1]][row.index,p.index])),4,"left",ellipsis = "")),
paste("*p* < 0.001")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment