data(pedalfast, pedalfast_metadata, package = "pedalfast.data")
# The Motor GCS in the emergency department is reported as an integer value.
str(pedalfast$gcsmotored)
# Each integer value a specific meaning
pedalfast_metadata[grepl("gcsmotored", pedalfast_metadata$variable), ]
# Creating the factor in base R
pedalfast_factor(x = c(1, 3, 2), variable = "gcsmotored")
pedalfast_factor(x = c(1, 3, 2), variable = "gcsmotored", label_with_level = TRUE)
Run the code above in your browser using DataLab