create_unit | R Documentation |
Works like create_units
, but for a single unit. The values can
then directly be provided in the set_ functions. The advantage of creating a
single unit is that it provides more flexibility. This is especially useful
for adding survey questions and units for testing or training coders.
create_unit(id, ..., type = "code", codebook = NULL)
id |
A unique id |
... |
Additional arguments passed to |
type |
The unit type. Can be 'code', 'test', 'train' or 'survey' |
codebook |
Optionally, provide a unit-level codebook. |
A codingjobUnits object.
unit1 <- create_unit(
"id",
set_text("text", "This is the unit text")
)
## this is also a good way to create custom training units
codebook <- create_codebook(
question("variable", question = "Is this a text?", codes = c("yes", "no"))
)
unit2 <- create_unit("id",
type = "train",
set_text("text", "This is the unit text"),
set_train("variable", "yes", message = "WRONG!!\n\ntry again"),
codebook = codebook
)
## single units are returned as a codingjobUnits list of length 1. This means
## that you can combine different units (and the results of create_units)
units <- c(unit1, unit2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.