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

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:

  • id: Variable with identification numbers

  • item_1 to item_n Questionnaire items

Examples

if (FALSE) { # 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) }