View source: R/create_survey.R
create_survey | R Documentation |
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.
create_survey( survey_name, path, save_to_sheets = TRUE, mailchimp_integration = FALSE, automated_report = TRUE )
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: |
mailchimp_integration |
Logical: |
automated_report |
Logical: |
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/.
A new RStudio Project the infrastructure needed to launch a survey in Shiny.
if (interactive()) { create_survey(survey_name = "testSurvey") }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.