| ply_help | R Documentation |
apply functionsApply a function over elements, rows, columns, or all dimensions; to an atomic object, a multivec, vec, vlist, matrix, or data.frame; and/or check the number of TRUE values in the result.
ply_help()
ply(.x, .fun, ..., .dim = 0, .proc = NULL)
none_ply(.x, .fun, ..., .dim = 0, .proc = NULL)
any_ply(.x, .fun, ..., .dim = 0, .proc = NULL)
some_ply(.x, .fun, ..., .dim = 0, .proc = NULL)
many_ply(.x, .fun, ..., .dim = 0, .proc = NULL)
all_ply(.x, .fun, ..., .dim = 0, .proc = NULL)
one_ply(.x, .fun, ..., .dim = 0, .proc = NULL)
two_ply(.x, .fun, ..., .dim = 0, .proc = NULL)
atm_ply(.x, .fun, ..., .proc = NULL)
mvc_ply(.x, .fun, ..., .proc = NULL)
vec_ply(.x, .fun, ..., .proc = NULL)
row_ply(.x, .fun, ..., .proc = NULL)
col_ply(.x, .fun, ..., .proc = NULL)
dim_ply(.x, .fun, ..., .proc = NULL)
vls_ply(.x, .fun, ..., .proc = NULL)
.x |
An object to apply |
.fun |
Function or character scalar name of a function to apply to |
... |
An arbitrary number of additional arguments to be passed to the function |
.dim |
A complete non-negative whole-number vec giving dimension(s) of |
.proc |
Either |
ply(): Generalized ply function.
none_ply(): Check for 0 resulting TRUE values in the result (assumes that .fun produces logical values).
any_ply(): Check for 1+ resulting TRUE values in the result (assumes that .fun produces logical values).
some_ply(): Check for 2+ resulting TRUE values in the result (assumes that .fun produces logical values).
many_ply(): Check for 3+ resulting TRUE values in the result (assumes that .fun produces logical values).
all_ply(): Check for only TRUE values in the result (assumes that .fun produces logical values).
one_ply(): Check for exactly 1 resulting TRUE values in the result (assumes that .fun produces logical values).
two_ply(): Check for exactly 2 resulting TRUE values in the result (assumes that .fun produces logical values).
atm_ply(): Apply .fun to atomized .x.
mvc_ply(): Apply .fun to elements of atomic multivec .x.
vec_ply(): Apply .fun to elements of atomic vec .x.
row_ply(): Apply .fun to rows of .x.
col_ply(): Apply .fun to columns of .x.
dim_ply(): Apply .fun to cells of .x.
vls_ply(): Apply .fun to elements of atomic vlist .x.
.proc argumentWhen not NULL, the .proc argument is an optional list with up to seven named elements, which give processing instructions as follows:
| Name + value | Processing instructions |
$arg = '{spec}' | Check .x for match to spec^{(1)}. |
$out = '{spec}' | Check result for match to '{spec}'.^{(1)} |
$agg = 'none' | Inspect result for 0 TRUE values. |
$agg = 'one' | Inspect result for 1 TRUE values. |
$agg = 'two' | Inspect result for 2+ TRUE values. |
$agg = 'any' | Inspect result for any TRUE values. |
$agg = 'all' | Inspect result for only TRUE values. |
$na = 'err' | Throw error if result has any NA values. |
$na = FALSE | Replace resulting NAs with FALSE. |
$na = TRUE | Replace resulting NAs with TRUE. |
$a1 = TRUE | Atomize .x. |
$a2 = TRUE | Atomize the result. |
$s = TRUE | Simplify the result. |
^{(1)} {spec} is a placeholder for a valid property spec. |
Other meta:
callers(),
console_help(),
dot_args(),
pause(),
purge_help(),
recycling_help(),
run()
egNumVec <- 1:5
egNumMat <- matrix(1:25, nrow = 5)
egChrDtf <- dtf(az = letters[1:10], AZ = LETTERS[1:10], nm = as.character(0:9))
egChrVls <- list(az = letters, AZ = LETTERS, nm = as.character(0:9))
egComp <- function(.x, comp, value) {if (comp == "<") {.x < value} else {.x > value}}
egNumVec
egNumMat
egChrDtf
egChrVls
none_ply(egNumVec, egComp, ">", value = 6)
none_ply(egNumVec, egComp, ">", value = 4)
any_ply(egNumVec, egComp, ">", value = 6)
any_ply(egNumVec, egComp, ">", value = 4)
all_ply(egNumVec, egComp, "<", value = 6)
all_ply(egNumVec, egComp, "<", value = 4)
one_ply(egNumVec, egComp, ">", value = 6)
one_ply(egNumVec, egComp, ">", value = 4)
two_ply(egNumVec, egComp, ">", value = 2)
two_ply(egNumVec, egComp, ">", value = 5)
two_ply(egNumMat, egComp, ">", value = 15, .dim = 2)
dim_ply(egNumMat, egComp, ">", value = 15)
dim_ply(egChrDtf, toupper)
row_ply(egNumMat, sum)
col_ply(egChrDtf, paste0, collapse = "")
vls_ply(egChrVls, paste0, collapse = "")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.