Combine Variables in a Matrix
ynbind
column binds a series of related yes/no variables,
allowing for a final argument label
used to label the panel
created for the group. label
s for individual variables are
collected into a vector attribute "labels"
for the result;
original variable names are used in place of labels for those variables
without labels. A positive response is taken to be y, yes,
present
(ignoring case) or a logical
TRUE
value. By
default, the columns are sorted be ascending order or the overall
proportion of positives. A subsetting method is provided for objects of
class "ynbind"
.
pBlock
creates a matrix similarly labeled, from a general set of
variables (without special handling of binaries), and sets to NA
any observation not in subset
so that when that block of
variables is analyzed it will be only for that subset.
ynbind(..., label = deparse(substitute(...)), asna = c("unknown", "unspecified"), sort = TRUE) pBlock(..., subset=NULL, label = deparse(substitute(...)))
... |
a series of vectors |
label |
a label for the group, to be attached to the resulting
matrix as a |
asna |
a vector of character strings specifying levels that are
to be treated the same as |
sort |
set to |
subset |
subset criteria - either a vector of logicals or subscripts |
a matrix of class "ynbind"
or
"pBlock"
with "label"
and "labels"
attributes.
For "pBlock"
, factor input vectors will have values converted
to character
.
Frank Harrell
x1 <- c('yEs', 'no', 'UNKNOWN', NA) x2 <- c('y', 'n', 'no', 'present') label(x2) <- 'X2' X <- ynbind(x1, x2, label='x1-2') X[1:3,] pBlock(x1, x2, subset=2:3, label='x1-2')
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.