nettskjema_get_extra: Add additional answer data

View source: R/nettskjema_get_form.R

nettskjema_get_extraR Documentation

Add additional answer data

Description

The answers in the nettskjema forms have some extra information attached that is not returned by default. This is for instance information on the order of the answer options, the true text, whether the answer is correct or if it is preselected. This function makes it possible to retrieve and add this information to the nettskjema data, using the codebook.

Usage

nettskjema_get_extra(data, codebook, information, use_codebook = TRUE, ...)

Arguments

data

tibble. Data retrieved from nettskjema

codebook

codebook object retrieved by nettskjema_get_codebook

information

character vector of information to add. One or more of "order", "option", "correct" "preselected".

use_codebook

logical. Use codebook for retrieving answers (default TRUE). If you have not set up the codebook in nettskjema, then turning this off will return the data as is.

...

arguments passed to GET

Value

tibble with added columns

Examples

## Not run: 
form_id <- 100000

my_data <- nettskjema_get_data(form_id)
cb <-  nettskjema_get_codebook(form_id)

my_data <- nettskjema_get_extra(my_data, cb, "order")


## End(Not run)

LCBC-UiO/nettskjemar documentation built on Aug. 24, 2023, 5:44 p.m.