surveybuilder: Make Surveys and Randomized Survey Experiments in R

surveybuilder is a package for creating surveys in PDF format using R, and can accomodate a range of in-built and custom randomization schemes. It also makes the generation and numbering of survey modules and questions much easier and quicker than manual PDF methods. surveybuilder compiles surveys in the $\LaTeX$ environmet, using the paperandpencil package, designed by Miriam Dieter & Anja Zwingenberger at University of Duisburg-Essen in 2009, see here for more details.

You can install surveybuilder using the following code:

library(devtools)
install_github(repo = "surveybuilder",
               username = "jaspercooper")

Load as follows:

library(surveybuilder)

Making questions

Open questions

All questions have an optional question prompt and comment option. Open questions can be followed by an arbitrary number of lines or dots.

# No lines, no comment
make_open_question(
  question_prompt = "How was your day?",
  concat = T)
# With comment
make_open_question(
  question_prompt = "How was your day?",
  comment = "\\emph{I honestly want to know!}",
  concat = T)
# With 1 line
make_open_question(
  question_prompt = "How was your day?",
  comment = "\\emph{I honestly want to know!}",
  N_lines = 1,
  concat = T)
# With 2 dotted lines
make_open_question(
  question_prompt = "How was your day?",
  comment = "\\emph{I honestly want to know!}",
  N_dot_lines = 2,
  concat = T)

Multiple choice questions

Multiple choice questions can be formatted in horizontal or vertical styles.

# Horizontal with labels on top
make_horizontal_question(
  question_prompt = "How likely are you to use this package?",
  upper_labels = c("Not a chance",
                   "Maybe once in a while",
                   "Literally. Every. Day."),  
  concat = T)
# Horizontal with labels on bottom
make_horizontal_question(
  question_prompt = "How likely are you to use this package?",
  lower_labels = c("Not a chance",
                   "Maybe once in a while",
                   "Literally. Every. Day."),
  concat = T)
# Horizontal with labels on top and bottom
make_horizontal_question(
  question_prompt = "How likely are you to use this package?",
  upper_labels = c("Not a chance",
                   "Maybe once in a while",
                   "Literally. Every. Day."),
  lower_labels = c(1,2,3),
  concat = T)
# Vertical
make_vertical_question(
  question_prompt = "How likely are you to use this package?",
  labels = c("Not a chance",
             "Maybe once in a while",
             "Literally. Every. Day."),
  concat = T)

Numeric questions

You can add questios with number boxes for measurement (years, meters, events, etc.).

# For a single box
make_numeric_question(
  question_prompt = "How many hours have you spent writing surveys in Excel and Word?",
  labels = c("minutes","hours","days"),
  N_boxes = c(2,2,1),
  concat = T)
# For five boxes, with different labels at different points
make_numeric_question(
  question_prompt = "How many hours have you spent writing surveys in Excel and Word?",
  labels = c("minutes","hours","days"),
  N_boxes = c(2,2,1),
  concat = T)

Note that cm_from_left can be used to set the location of the numeric boxes on the page.

Grids of questions

You can also ask multiple horizontal or vertical questions using answers that share the same scale.

# Vertical questions, horizontal answers
make_grid_question(
  question_prompt = "Rate the following items from 1 (not great) to 5 (not bad).",
  comment = "\\emph{Try to remain unenthused}",
  vertical_labels = c("Hi-Fives","Rollercoasters","Quiet Strolls"),
  horizontal_labels = 1:5,
  concat = T)
# Horizontal questions, vertical answers
make_grid_question(
  question_prompt = "Rate the following items from 1 (not great) to 5 (not bad).",
  comment = "\\emph{Try to remain unenthused}",
  vertical_labels = 1:5,
  horizontal_labels = c("Hi-Fives","Rollercoasters","Quiet Strolls"),
  concat = T)

Prompts or arbitrary additions

You can also add in any of the usual .tex elements, such as
lines, page breaks, prompts, or section titles. Be sure to add in an extra "\" whenever you need to add a backslash.

make_prompt(prompt = "\\clearpage",concat = T)

Making Surveys

Non-Randomized Surveys

Simple-Randomized Surveys

Complete-Randomized Surveys

Arbitrary Randomization Schemes

To be continued...



jaspercooper/surveybuilder documentation built on May 18, 2019, 5:55 p.m.