formr_reverse: Reverse items based on item table or a fallback_max

View source: R/connect_to_formr.R

formr_reverseR Documentation

Reverse items based on item table or a fallback_max

Description

Example: If your data contains Extraversion_1, Extraversion_2R and Extraversion_3, there will be two new variables in the result: Extraversion_2 (reversed to align with _1 and _2) and Extraversion, the mean score of the three. If you supply an item table, the maximum possible answer to the item will be used to reverse it. If you don't, the maximum actually given answer or the fallback_max argument will be used to reverse it. It's faster to do this without an item table, but this can lead to problems, if you mis-specify the fallback max or the highest possible value does not occur in the data.

Usage

formr_reverse(results, item_list = NULL, fallback_max = 5)

Arguments

results

survey results

item_list

an item_list, defaults to NULL

fallback_max

defaults to 5 - if the item_list is set to null, we will use this to reverse

Examples

## Not run: 
formr_connect(email = 'you@example.net', password = 'zebrafinch' )
icar_items = formr_items(survey_name='ICAR',host = 'http://localhost:8888/formr/')
# get some simulated data and aggregate it
sim_results = formr_simulate_from_items(icar_items)
reversed_items = formr_reverse(item_list = icar_items, results = sim_results)

## End(Not run)
results = jsonlite::fromJSON(txt = 
	system.file('extdata/gods_example_results.json', package = 'formr', mustWork = TRUE))
items = formr_items(path = 
	system.file('extdata/gods_example_items.json', package = 'formr', mustWork = TRUE))
formr_reverse(results, items)

rubenarslan/formr documentation built on Feb. 6, 2024, 1:18 a.m.