This helper function names any unnamed elements in the blocks
specification. This is a convenience function.
Usage
name.blocks(x, prefix = "B")
Arguments
- x
A data.frame
, character vector with
variable names, or list
with variable names.
- prefix
A character vector of length 1 with the prefix to
be using for naming any unnamed blocks with two or more variables.
Value
A named list of character vectors with variables names.
Details
This function will name any unnamed list elements specified in
the optional argument blocks
. Unnamed blocks
consisting of just one variable will be named after this variable.
Unnamed blocks containing more than one variables will be named
by the prefix
argument, padded by an integer sequence
stating at 1.
Examples
blocks <- list(c("hyp", "chl"), AGE = "age", c("bmi", "hyp"), "edu")
name.blocks(blocks)
#> $B1
#> [1] "hyp" "chl"
#>
#> $AGE
#> [1] "age"
#>
#> $B2
#> [1] "bmi" "hyp"
#>
#> $edu
#> [1] "edu"
#>