Generate random values from a wakefield variable function.
r_dummy(fun, n, ..., prefix = FALSE, rep.sep = "_")
A wakefield variable function.
The number of rows to produce.
logical. If TRUE
the original factor name (supplied to
fun
as name
argument) will prefix the column names that were
generated from the factor's categories.
A separator to use for the variable and category part of names
when prefix = TRUE
. For example if the age
is used (r_dummy(sex)
), this results in column names
c("Sex_Male", "Sex_Female")
.
Additional arguments passed to fun
.
Returns a tbl_df
.
# NOT RUN {
r_dummy(sex, 10)
r_dummy(race, 1000)
r_dummy(race, 1000, name = "Ethnicity")
# }
Run the code above in your browser using DataLab