View source: R/has_quant_labs.R
has_quant_labs | R Documentation |
add_quant_labs()
-style Value-labeled Variable (Column)?Determine whether a specific variable of a data.frame has value labels
associated with it that were added using add_quant_labs()
or add_quant1()
.
has_quant_labs(data, var)
data |
a data.frame. |
var |
the unquoted name of the variable (column) to check for the
presence of |
hql
is a compact alias for has_quant_labs
: they do the same thing, and
the former is easier to type
A 1L logical.
# copy mtcars to mt2 and assign various types of value labels
mt2 <- mtcars
# add 1-to-1 value labels
mt2 <- add_val_labs(
data = mt2,
vars = "am",
vals = c(0, 1),
labs = c("automatic", "manual")
)
has_val_labs(mt2, am) # TRUE, it does
has_m1_labs(mt2, am) # FALSE, they are NOT add_m1_lab()-style
has_quant_labs(mt2, am) # FALSE, they are NOT add_quant_labs() -style
# add many-to-1 value labels
mt2 <- add_m1_lab(
data = mt2,
vars = "gear",
vals = 4:5,
lab = "4+"
)
has_val_labs(mt2, gear) # TRUE, it does
has_m1_labs(mt2, gear) # TRUE, they ARE add_m1_lab()-style
has_quant_labs(mt2, gear) # FALSE, they NOT not add_quant_labs() -style
# add quartile-based numerical range value labels
mt2 <- add_quant_labs(
data = mt2,
vars = "disp",
qtiles = 4
)
has_val_labs(mt2, disp) # TRUE, it does
has_m1_labs(mt2, disp) # FALSE, they are NOT add_m1_lab()-style
has_quant_labs(mt2, disp) # TRUE, they ARE add_quant_labs() -style
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.