Last chance! 50% off unlimited learning
Sale ends in
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(...)))
"label"
attribute, used by summaryP
.NA
if presentFALSE
to not sort the columns by their
proportions"ynbind"
or
"pBlock"
with "label"
and "labels"
attributes.
For "pBlock"
, factor input vectors will have values converted
to character
.
summaryP
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')
Run the code above in your browser using DataLab