add_responses: Write a Response rds File for Turk

Description Usage Arguments Value Examples

Description

add_responses - Adds the list of responses, google form link, and response type .rds file directly to the project directory.

Usage

1
add_responses(projects.path, responses, googleform_url, type = "radio", ...)

Arguments

responses

A vector of responses to eb repeated each time 'next' is clicked.

googleform_url

A google form url (google form should be a url to a google form with a text box for (a) user, (b) question ID (c) the clicked response in that order).

type

The type of response. Currently (radio is supported). Plan to add slider (numeric) and checkbox types as well.

project.path

A path the the projects directory.

path

Path of where to put the .rds file.

...

Other arguments passed to sliderInput (c("min", "max", "value", "step"))

Value

Returns the project.path so it can be used with make_project and add_prompts within a magrittr chain.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
temp <- tempdir()

## radio responses
responses1 <- c("Very Poor", "Poor", "Neutral", "Good", "Very Good")

write_responses(
    responses = responses1, 
    googleform_url = 'https://docs.google.com/forms/d/1iLiHtE6xFUzYMN8iB3AXD5xRYVY_oI5Cps1uaujZGng', 
    path = file.path(temp, "responses_radio.rds"),
    type = "radio"
)
readRDS(file.path(temp, "responses_radio.rds"))

## checkbox responses
responses2 <- c("Orange", "Yellow", "Green", "Blue", "Red", "Purple")

write_responses(
    responses = responses2, 
    googleform_url = 'https://docs.google.com/forms/d/1iLiHtE6xFUzYMN8iB3AXD5xRYVY_oI5Cps1uaujZGng', 
    path = file.path(temp, "responses_checkbox.rds"),
    type = "checkbox"
)
readRDS(file.path(temp, "responses_checkbox.rds"))

## slider responses
write_responses(
    responses = "Rate the statement poor-1 to great-5", 
    googleform_url = 'https://docs.google.com/forms/d/1iLiHtE6xFUzYMN8iB3AXD5xRYVY_oI5Cps1uaujZGng', 
    path = file.path(temp, "responses_slider.rds"),
    type = "slider",
    max = 5, 
    min = 1,
    value = 3,
    step = .001
)
readRDS(file.path(temp, "responses_slider.rds"))

## Not run: 
## In a magrittr pipeline
library(dplyr)
prompts <- c("I am sam", "He is greg", "We are us.")
responses <- c("Orange", "Yellow", "Green", "Blue", "Red", "Purple")

make_project(
    path = "L:/swiper/shinyTurk/turk_items/ce_question_tagging_validation",
    key.value = 9999
) %>%
    add_prompts(prompts) %>%
    add_responses(
        responses = responses,
        googleform_url = 'https://docs.google.com/forms/d/1iLiHtE6xFUzYMN8iB3AXD5xRYVY_oI5Cps1uaujZGng', 
        type = "checkbox"        
    )   

## End(Not run)

trinker/shinyTurkTools documentation built on May 31, 2019, 10:41 p.m.