create_survey: Create a responsematch 'Shiny' Survey Application

View source: R/create_survey.R

create_surveyR Documentation

Create a responsematch 'Shiny' Survey Application

Description

This function can be used to create a Shiny Survey application. It takes in two parameters: survey_name, which specifies the name of the survey – e.g. "GLI" – and path, which specifies where the application should be created.

Usage

create_survey(
  survey_name,
  path,
  save_to_sheets = TRUE,
  mailchimp_integration = FALSE,
  automated_report = TRUE
)

Arguments

survey_name

The name of the survey application to create, e.g. "GLI".

path

The path specifying where the survey application should be created. Default is the current working directory.

save_to_sheets

Logical: TRUE by default and a Google Sheet will be set up for the survey data to be saved remotely. FALSE and it won't be. The survey data could be saved locally with the variable rv$response.

mailchimp_integration

Logical: FALSE by default. If TRUE then code to integrate mailchimp audiences will be included in the Shiny app. Follow comments in-app to set it up. FALSE and mailchimp integration will not be included.

automated_report

Logical: TRUE by default and code to generate an automated report will be included in the Shiny app. FALSE and it won't be.

Details

Assuming the data should be stored to Google Drive/Google Sheets (see function arguments for more details), running this function will result in your internet browser will open and you will be asked to authenticate your Google Drive and Google Sheets information. This is necessary to remotely store respondent's data.

After Google Drive and Google Sheets authentication, a new RStudioProjecthttps://r4ds.had.co.nz/workflow-projects.html will be created at the specified path, with a suffix 'survey-project'.

The RStudio project will open in a new R Session automatically. In the file pane, there will be a folder with a suffix '-app', containing an 'app.R' file – defining the user-interface and server-side logic of the survey – a 'www' folder – housing the survey questions, RMarkdown report, and custom JavaScript – and an 'R' directory containing additional functions used by the application.

The Shiny application is fully functioning at this point, however, you must modify the survey questions and parameterized RMarkdown report located in the 'www' subdirectory.

In order to deploy the survey to shinyapps.io, you may click the 'deploy' button at the top right of the RStudio IDE. For more details on deployment, please see my blog post on getting started with[shinyapps.io]https://www.jdtrat.com/blog/getting-started-shinyapps/.

Value

A new RStudio Project the infrastructure needed to launch a survey in Shiny.

Examples


if (interactive()) {
create_survey(survey_name = "testSurvey")
}


jdtrat/responsematch documentation built on Sept. 15, 2022, 6:19 a.m.