Skip to contents

Count columns with Value (at or) above (or below) threshold

Usage

colcounter(
  x,
  threshold,
  or.tied = TRUE,
  na.rm = TRUE,
  below = FALSE,
  one.cut.per.col = FALSE
)

Arguments

x

Data.frame or matrix of numbers to be compared to threshold value.

threshold

numeric threshold value to compare to

or.tied

if TRUE, include ties (value in x equals threshold)

na.rm

if TRUE, used by colcounter to count only the non-NA columns in given row

below

if TRUE, count x below threshold not above threshold

one.cut.per.col

if FALSE, compare 1 threshold to all of x. If TRUE, specify one threshold per column.

Value

vector of counts as long as NROW(x)

Examples

if (FALSE) { # \dontrun{
  pdata <- data.frame(a=rep(80,4),b=rep(93,4), col3=c(49,98,100,100))
 # pdata <- data.frame(testoutput_ejamit_10pts_1miles$results_bysite)[ , names_e_pctile]
 pcuts <-  5 * (0:20) 
colcounter_summary(        pdata, pcuts)
colcounter_summary_pct(    pdata, pcuts)
colcounter_summary_cum(    pdata, pcuts)
colcounter_summary_cum_pct(pdata, pcuts)
colcounter_summary_cum_pct(pdata, 5 * (10:20))

x80 <- colcounter(pdata, threshold = 80, or.tied = T)
x95 <- colcounter(pdata, threshold = 95, or.tied = T)
table(x95)
tablefixed(x95, NCOL(pdata))
cbind(at80=tablefixed(x80, NCOL(pdata)), at95=tablefixed(x95, NCOL(pdata)))
  } # }