code {rcoder} | R Documentation |
Encode a label to a value with other metadata
Description
The most fundamental components of a 'code' object are the 'label' and 'value' elements. A 'code' object is essentially a key-value tuple that has some extra metadata.
Usage
code(
label,
value,
description = label,
links_from = label,
missing = FALSE,
...
)
Arguments
label |
A short label for a value in a vector |
value |
The raw value found in the respective vector |
description |
A longer-form label for the value, if extra context for that label is needed |
links_from |
A reference to another 'code' in another 'coding' object for recoding purposes. |
missing |
Whether this 'code' represents a missing response |
... |
Any extra metadata |
Value
A 'code' object that contains the key-value map of label to value
Examples
code("Yes", 1)
code("No", 0)
code(
"No response", -88,
description = "Participant ignored question when prompted",
missing = TRUE
)
code("Missing", NA, links_from = c("Refused", "Absent"))
[Package rcoder version 0.3.0 Index]