Learn R Programming

ibdreg (version 0.2.2)

minpRows: find the rows of a data frame with the minimum pvalue

Description

find the rows of a data frame with the minimum pvalue, best used in a print or summary function to summarize a group of test statistics.

Usage

minpRows(obj, colnames=NULL, rowname=NULL, col.indx=ncol(obj))

Arguments

obj
a data frame for a group of statistical tests, with pvalues
colnames
new names to give to columns
rowname
new names to give the row(s). If multiple rows contain the minimum pvalue, rowname is assigned to each of them, appending a digit at the end (1, 2, etc).
col.indx
the index of the columns that contains the pvalue, default is the last column of obj

Value

  • a subset of the obj data.frame rows

Examples

Run this code
## create a data frame of chi-square(1) tests
tests <- data.frame(pos=1:3, chitest=c(3,4,2), df=rep(1,3), 
                    pval=1-pchisq(c(3,4,2), df=1))

# find the rows of the best tests
best.tests <- minpRows(tests, colnames=c("position", "chi.test", "df","pvalue"))

Run the code above in your browser using DataLab