get_var_info | R Documentation |
get_var_info()
allows you to peek at your labelled data,
extracting a given column's variable labels. The intended use here is mostly
"peeking" for the purpose of recoding column's in the absence of a codebook or
other form of documentation. gvi()
is a shortcut for this function.
get_var_info(.data, x)
gvi(...)
.data |
a data frame |
x |
a column within the data frame |
... |
optional, only to make the shortcut ( |
This function leans on var_label()
and val_label()
in the
labelled
package, which is a dependency for this package. The function
is designed to be used in a "pipe."
If the column in the data frame is not labelled, the function returns a message communicating
the absence of labels. If the column in the data frame is labelled, the function returns
a small data frame communicating the var_label()
output (var
), the (often but not always)
numeric "code" coinciding with with the label (code
), and the "label" attached to it (label
).
library(tibble)
library(dplyr)
library(magrittr)
ess9_labelled %>% get_var_info(netusoft) # works, as intended
ess9_labelled %>% get_var_info(cntry) # works, as intended
ess9_labelled %>% get_var_info(ess9round) # barks at you; data are not labelled
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.