View source: R/make_likert_data.R
make_likert_data | R Documentation |
make_likert_data
generates a data.frame with select (entirely fictional)
numerically coded responses of fictional people to fictional survey items to
demonstrate and explore labelr functionalities.
make_likert_data(n = 1000, scale = 1:7, rownames = TRUE)
n |
number of observations (rows) of hypothetical data set to create. |
scale |
the sequence of distinct integer values describing the raw / naive numerical codings of Likert-type survey items. |
rownames |
create memorable but arbitrary rownames for inspection (if TRUE). |
Data is entirely fictional and strictly for purposes of demonstrating labelr.
a data.frame.
# add_val_labs() "vars" arg will do partial matching if partial = TRUE
# in this case, we catch all vars with "x" in their name
set.seed(272)
dflik <- make_likert_data(scale = 1:7)
vals2label <- 1:7
labs2use <- c(
"VSD",
"SD",
"D",
"N",
"A",
"SA",
"VSA"
)
dflik <- add_val_labs(
data = dflik, vars = c("x", "y3"), # note the vars args
vals = vals2label,
labs = labs2use,
partial = TRUE
)
# note, all "x" vars get the labs, as does "y3"
# see vars = args above
lik1 <- use_val_labs(dflik)
head(lik1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.