Summarize how many rows have N columns at or above (or below) various thresholds?
Source:R/colcounter_xyz.R
colcounter_summary.Rd
Like colcounter() or cols.above.count() but will handle multiple thresholds to compare to each indicator, etc.
Table of counts, percents, cumulative counts, cumulative percents of places with N, or at least N, of the indicators at or above the benchmark(s)
Usage
colcounter_summary(
x,
thresholdlist,
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, like percentiles for example.
- thresholdlist
vector of numeric threshold values 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 each threshold to all of x. If TRUE, specify one threshold to use for each column.
Examples
pdata <- data.frame(a=rep(80,4),b=rep(93,4), col3=c(49,98,100,100))
### pdata <- EJAM::blockgroupstats[ , 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))
a3 <- colcounter_summary_all( pdata, pcuts)
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)))