Count columns with Value (at or) above (or below) threshold
Source:R/colcounter_xyz.R
colcounter.Rd
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.
Examples
# \donttest{
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)
#> Error in colcounter_summary(pdata, pcuts): could not find function "colcounter_summary"
colcounter_summary_pct( pdata, pcuts)
#> Error in colcounter_summary_pct(pdata, pcuts): could not find function "colcounter_summary_pct"
colcounter_summary_cum( pdata, pcuts)
#> Error in colcounter_summary_cum(pdata, pcuts): could not find function "colcounter_summary_cum"
colcounter_summary_cum_pct(pdata, pcuts)
#> Error in colcounter_summary_cum_pct(pdata, pcuts): could not find function "colcounter_summary_cum_pct"
colcounter_summary_cum_pct(pdata, 5 * (10:20))
#> Error in colcounter_summary_cum_pct(pdata, 5 * (10:20)): could not find function "colcounter_summary_cum_pct"
x80 <- colcounter(pdata, threshold = 80, or.tied = T)
x95 <- colcounter(pdata, threshold = 95, or.tied = T)
table(x95)
#> x95
#> 0 1
#> 1 3
tablefixed(x95, NCOL(pdata))
#> 0 1 2 3
#> 1 3 0 0
cbind(at80=tablefixed(x80, NCOL(pdata)), at95=tablefixed(x95, NCOL(pdata)))
#> at80 at95
#> 0 0 1
#> 1 0 3
#> 2 1 0
#> 3 3 0
# }