simulate_items: Simulate questionnaire items

Description Usage Arguments Value Examples

View source: R/datasim.R

Description

The function simulates a data.frame including an id variable and the items of any questionnaire.

Usage

1
2
3
4
5
6
7
simulate_items(
  num_cols = 10,
  num_rows = 100,
  item_name = "item",
  item_range = 0:3,
  prop_mis = 0.05
)

Arguments

num_cols

Number of items (default = 10)

num_rows

Number of rows (default = 100)

item_name

Abbreviated name of questionnaire (default = 'item')

item_range

Item Range (is the same for each item; default = 0 to 3)

prop_mis

Proportion of missing values to be put into each item (default = 0.05)

Value

The function returns the following variables:

Examples

1
2
3
4
5
6
7
## Not run: 
# Simulate Hospital Anxiety and Depression Scale
library(dplyr)
library(wakefield)
df <- simulate_items(num_cols = 14, num_rows = 100, item_name = "hads", item_range = 0:3, prop_mis = 0.05)

## End(Not run)

nrkoehler/qscorer documentation built on April 5, 2020, 3:09 a.m.