Skip to navigation

Nicely formatted p values in Sweave

R function:

pval <- function (x) {

For any p < 0.001, this will output "p < 0.001", else it will give the exact value (e.g. p = .04). Then, in the latex part of your document, refer to it as:


where T.TEST is a t.test (either direct code or an object).

Comments are closed.