fixp: Fix P-Values

Description Usage Arguments Details Author(s) Examples

View source: R/fixp.R

Description

A function to fix p-values in summaries for xtable. P-values should never display zero (mathematically), so this attempts to correct them. This will mostly be used for the coefficient section of summary tables from R when going into x-table

Usage

1
fixp(x, dig = 2)

Arguments

x

The summary table to "fix" the p-values for

dig

The number of digits you wish to round to

Details

Thus function expects summary tables (and turns them into a data.frame). It assumes that the last column of the table contains p-values (with the name Pr..., normal in many summary tables). It will shoot a warning letting you know if you are using the function with a table that doesn't have a name that starts with this for the last column, though it will still run. The function takes the data frame and manipulates all values that round to 0 (at the set digits) to instead display that the p-value is less than the current rounded digits outcome. Note that this makes the last column of the output dataframe either character or numeric.

Author(s)

Michael Floren

Examples

1
2
3
4
5
#this gives a summary table with a small p-value
(mod <- coef(summary(lm(uptake ~ conc + Treatment + Type + Plant, data=CO2))))

#this fixes the p-value to 4 digits, correctly reporting p-values that would have been rounded to 0
fixp(mod,dig=4)

flor3652/myStuff documentation built on Sept. 14, 2020, 1:16 a.m.