diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/.nojekyll @@ -0,0 +1 @@ + diff --git a/404.html b/404.html index 0c900077..c42694ac 100644 --- a/404.html +++ b/404.html @@ -12,7 +12,7 @@ - + @@ -26,7 +26,7 @@ - +
- +
@@ -117,16 +123,16 @@

Page not found (404)

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/LICENSE-text.html b/LICENSE-text.html index 0700cacb..2aa88f38 100644 --- a/LICENSE-text.html +++ b/LICENSE-text.html @@ -1,9 +1,9 @@ -License • surveydownLicense • surveydown - +
- +
@@ -84,15 +90,15 @@

License

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/LICENSE.html b/LICENSE.html index b178d6fd..51474c93 100644 --- a/LICENSE.html +++ b/LICENSE.html @@ -1,9 +1,9 @@ -MIT License • surveydownMIT License • surveydown - +
- +
@@ -88,15 +94,15 @@

MIT License

-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/apple-touch-icon-120x120.png b/apple-touch-icon-120x120.png index ee00c939..70fc7337 100644 Binary files a/apple-touch-icon-120x120.png and b/apple-touch-icon-120x120.png differ diff --git a/apple-touch-icon-152x152.png b/apple-touch-icon-152x152.png index e00af497..dd136e8a 100644 Binary files a/apple-touch-icon-152x152.png and b/apple-touch-icon-152x152.png differ diff --git a/apple-touch-icon-180x180.png b/apple-touch-icon-180x180.png index 0903feba..d52bc6c7 100644 Binary files a/apple-touch-icon-180x180.png and b/apple-touch-icon-180x180.png differ diff --git a/apple-touch-icon-60x60.png b/apple-touch-icon-60x60.png index 8e09f100..3e46de80 100644 Binary files a/apple-touch-icon-60x60.png and b/apple-touch-icon-60x60.png differ diff --git a/apple-touch-icon-76x76.png b/apple-touch-icon-76x76.png index 51a368b5..ca5314cc 100644 Binary files a/apple-touch-icon-76x76.png and b/apple-touch-icon-76x76.png differ diff --git a/apple-touch-icon.png b/apple-touch-icon.png index 68b38382..8306e09c 100644 Binary files a/apple-touch-icon.png and b/apple-touch-icon.png differ diff --git a/articles/1_overview.html b/articles/1_overview.html new file mode 100644 index 00000000..36f96b5d --- /dev/null +++ b/articles/1_overview.html @@ -0,0 +1,493 @@ + + + + + + + +1. Overview • surveydown + + + + + + + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +
+

The surveydown R package works together with the +surveydown Quarto extension. As a simplification, we call +them together as “surveydown” in this article.

+
+
+

Introduction +

+

surveydown is a handy tool for survey construction, +release, and data collection by creating Quarto +Shiny documents. It designs survey using Quarto, renders the UI with Shiny, and stores +data on Supabase. With +surveydown, you can create HTML survey pages by +constructing a Quarto doc with extension of qmd.

+

Quarto is a revolutionary +publication tool. A Quarto doc accepts markdown texts, R scripts, Python +scripts, and more. Shiny is an R web app +development platform. It provides interactive UI that responds to users’ +toggling. Supabase is an open-source +database supplier that delivers input-output services and exports our +survey results. For more information about their basic usage, please +proceed to their official websites.

+
+
+

Why Use surveydown +

+

surveydown is a very good alternative of Google Forms, +formr, Qualtrics, Survey Monkey, etc. It is markdown based, supports R +code chunks. It is free to use, highly reproducible and totally +sharable.

+
+
+

Preparation +

+

surveydown works with Quarto. Make sure you have the +latest version of Quarto installed. +Quarto works best with RStudio, but +you can also have it on VS +Code or Positron +(a novel IDE made by Posit), so please install Quarto together with any +IDE of your preference.

+

(Instructions here for installing +surveydown)

+
+
+

Basic Use +

+

Our HTML survey page is constructed using a .qmd file +(aka a Quarto Doc file). This file consists of 4 parts: a YAML +header, a setup code chunk, the survey body, and a server code chunk in +the end. Please see explanation below.

+
+

1. YAML Header +

+

YAML (Yet Another Markup Language) is an essential part for all +.qmd files. It regulates the basic settings, including page +layout, themes, add-on css or js files, etc., +of your HTML page. These settings are called keys.

+

Below are the essential YAML scripts for the +surveydown project. It contains two keys: server, and +filters.

+
---
+server: shiny
+filters: [surveydown]
+---
+

The server: shiny key designates the Shiny server to our +page, and filters: [surveydown] applies the surveydown +Quarto extension.

+

Below are the optional YAML scripts that you may +use:

+
---
+theme: united # Any bootswatch theme or a customized scss file
+barcolor: theme # "theme" (default) or a customized hex code
+barposition: top # "top" (default), "bottom", or "none" 
+---
+

There are 25 bootswatch themes +to choose from. You can also use our customized scss theme +file, or even combine these two. An example combination is shown +below:

+
---
+theme: [united, custom.scss]
+---
+

It means to use the united +bootswatch theme, and overwrite with the custom.scss +file. For example, if you don’t like the orange primary color of this +theme, you can define $primary as something else in your +own scss file. We’ve prepared a custom.scss +file in our surveydown demo +repo on GitHub.

+

The barcolor key defines the color of the progress bar. +It’s default to “theme”, meaning it will reflect any +primary color that the theme defines. You may also use any hex codes to +overwrite this color as you wish.

+

The barposition key defines the position of the progress +bar. It’s default to “top”, meaning the bar will be on the +top of the page. You can change to “bottom” or +“none”.

+

You may define other YAML scripts if you want to further customize +the layout of your HTML page.

+
+
+

2. Setup Codes +

+

After the YAML header, you’ll need to load the +surveydown package and run the sd_setup() +function:

+ +
+
+

3. Survey Body +

+

Now you are ready to start writing your survey contents. You can +write markdown texts for explanations and instructions, and insert R +code chunks to present survey questions.

+

Here is a question to get started. This question showcases what a +“multiple choice” question looks like, which is created using +type = 'mc' inside the sd_question() +function.

+

It also is an example of the show_if feature +(conditional display). If you choose the “Other” option, a second +question pops up below asking to specify which other type of penguin is +your favorite. This is a conditional question and is +controlled with the show_if argument to the +sd_config() function defined in the server section at the +bottom of the .qmd file, which will be described in 4. Server Codes.

+
+# A multiple choice question with an "Other" option
+sd_question(
+  type  = 'mc',
+  id    = 'penguins',
+  label = "Which is your favorite type of penguin?",
+  option = c(
+    'Adélie'    = 'adelie',
+    'Chinstrap' = 'chinstrap',
+    'Gentoo'    = 'gentoo',
+    
+    # This "Other" option triggers the "penguins_other" question
+    'Other'     = 'other'
+  )
+)
+
+# Controlled by the show_if argument of sd_config()
+sd_question(
+  type  = "text",
+  id    = "penguins_other",
+  label = "Please specify the other penguin type:"
+)
+

Screenshot for an ordinary option being chosen:

+
+

+
+

Screenshot for the “Other” option being chosen:

+
+

+
+
+
+

4. Server Codes +

+

The server codes are at the very bottom of the qmd file. +It consists of 3 parts:

+
    +
  1. A db variable, short for “database”, defined by the +sd_database() function.
  2. +
  3. A config variable, defined by the +sd_config() function. It takes in arguments of +show_if and skip_if. In show_if, +you can define an option to trigger an conditional question; in +skip_if, you define the option to jump over to a designated +page.
  4. +
  5. Calling the sd_server() function with fixed arguments. +This part is essential and has to be the same for every survey +project.
  6. +
+
+

4.1 Template +

+

Below is a template for the server codes:

+
+# See instructions in supabase setup
+db <- sd_database(
+  host       = "your_supabase_host",
+  db_name    = "your_supabase_db_name",
+  port       = "your_supabase_port",
+  user       = "your_supabase_user",
+  table_name = "your_customed_table",
+  password   = Sys.getenv("your_supabase_password")
+)
+
+# Define skip_if and show_if
+config <- sd_config(
+  skip_if = tibble::tribble(
+    ~question_id,  ~question_value, ~target,
+    "skip_to_page", "end",           "end",
+    "skip_to_page", "question_formatting",  "questionFormatting"
+  ),
+  show_if = tibble::tribble(
+    ~question_id,  ~question_value, ~target,
+    "penguins",    "other",         "penguins_other"
+  )
+)
+
+# The scripts below are essential
+sd_server(
+  input   = input,
+  session = session,
+  config  = config,
+  db      = db
+)
+
+
+

4.2 show_if +

+

Back to our example: in order for the conditional question to show +once the “Other” option is selected, you’ll need to define it in the +show_if argument under the sd_config() +function.

+
+config <- sd_config(
+  show_if = tibble::tribble(
+    ~question_id,  ~question_value, ~target,
+    "penguins",    "other",         "penguins_other"
+    )
+)
+

In the scripts above, we use a tribble to define the +show_if algorithm. We have question_id being +“penguins”, indicating the show_if algorithm +takes effect for the question with id being “penguins”. The +question_value is “other”, and the revealed +question has id of “penguins_other”.

+

By doing this, we successfully triggered the +“penguins_other” question upon selection of +“other” in the question “penguins”. This is +essentially important if you want participants to type in their +personalized answers that are not listed in your options.

+
+
+

4.3 skip_if +

+

The skip_if argument works similarly as +show_if. You indicate its functional +question_id, set the question_value (aka the +option) to trigger the page jump, and set the target value +as the landing page.

+
+config <- sd_config(
+  show_if = tibble::tribble(
+    ~question_id,  ~question_value, ~target,
+    "skip_to_page", "end",           "end"
+    )
+)
+

In the example above, the question with ID being +“skip_to_page” has an option of “end”. By +clicking on it, you’ll be directed to the page with ID of +“end”.

+
+
+Skip to the End
Skip to the End
+
+
+
+
+
+
+

Page Arrangement +

+
+

1. Example +

+

surveydown utilizes Shiny to arrange the pages. See the +example below as a template for page setup.

+
::: {#page_1 .sd-page}
+# Page 1
+
+Sample question
+
+sd_question(
+  type  = 'mc',
+  id    = 'mc_question',
+  label = "What's your favorite color?",
+  option = c(
+    'Red'    = 'red',
+    'Blue'   = 'blue',
+    'Orange' = 'orange'
+  )
+)
+
+<br>
+
+sd_next(next_page = 'page_2')
+:::
+
+::: {#page_2 .sd-page}
+# Page 2
+
+This is page 2
+
+<br>
+
+sd_next(next_page = 'end')
+:::
+
+::: {#end .sd-page}
+## Thanks for taking our survey!
+:::
+
+
+

2. Quarto Fences +

+

Quarto doc uses fences, embraced by 2 sets of three +colons :::, to regulate elements in a page, similar to the +<div> section in HTML pages. The curly braces +followed by the opening set of ::: regulates the css +settings of this fence. Therefore, a basic framework of a surveydown +page is like this:

+
::: {#page_1 .sd-page}
+
+Some contents
+
+<br>
+
+sd_next(next_page = 'page_2')
+:::
+
+
+

3. css Settings +

+

In the css settings, #page_1 indicates the name (or ID) +of this page is page_1. It is an important identifier for +the sd_next() and sd_config() functions:

+
    +
  • The sd_next() function regulates the designed page +flow.

  • +
  • The sd_config() function, as explained in 4. Server Codes, containing +skip_if and show_if values, regulates the +skipped landing and conditional revealing of the pages, +respectively.

  • +
+

If you’ve reached the ending page, the sd_next() +function is unnecessary. Otherwise, use this function to regulate the +page flow. The above example writes +sd_next(next_page = 'page_2'), meaning the next page will +be page_2.

+

The .sd-page class is pre-defined in +surveydown’s internal css. It means this fenced +element is treated as a surveydown page. Please +include this in your page setting.

+

We include an HTML line break <br> so that the +next page button does not directly contact the previous line.

+
+
+
+ + + +
+ + + + +
+ + + + + + + + diff --git a/articles/2_question_types.html b/articles/2_question_types.html new file mode 100644 index 00000000..970d27b7 --- /dev/null +++ b/articles/2_question_types.html @@ -0,0 +1,521 @@ + + + + + + + +2. Question Types • surveydown + + + + + + + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +
+

Use the sd_question() function to specify the question +types.

+
+
+

Introduction of Arguments +

+

This article showcases the different types of question supported by +surveydown. Each question requires the user to define the +following arguments to the sd_question() function:

+
    +
  • +id: A unique identifier for the question, which will be +used as the variable name in the resulting survey data.
  • +
  • +label: The label that will be displayed on the question +in the survey.
  • +
  • +type: The type of question, options include: +
      +
    • +text: Single line open text input.
    • +
    • +textarea: Multiple line open text input.
    • +
    • +numeric: Single line numeric text input.
    • +
    • +mc: Multiple choice with a single select option (radio +buttons).
    • +
    • +mc_buttons: Same as mc but as a “button” +style instead of radio buttons.
    • +
    • +mc_multiple: Multiple choice with mutliple select +options (check boxes).
    • +
    • +mc_multiple_buttons: Same as mc_multiple +but as a “button” style instead of check boxes.
    • +
    • +select: Select a choice from a drop down menu.
    • +
    • +slider: (Under construction) Slider to select discrete +categories or continuous numbers.
    • +
    • +date: Select a date from a calendar widget.
    • +
    • +daterange: Select two dates from calendar widgets +(e.g. begin and end dates).
    • +
    +
  • +
+
+
+

Question Types +

+
+

1. text +

+

Use type = 'text' to specify a text input type +question.

+

Scripts:

+
+sd_question(
+  type  = "text",
+  id    = "silly_word",
+  label = "Write a silly word:"
+)
+

Output:

+
+
+Figure 1: text Question Type
+Figure 1: text +Question Type +
+
+
+
+
+

2. textarea +

+

Use type = 'textarea' to specify a text area input type +question.

+

Scripts:

+
+sd_question(
+  type  = "textarea",
+  id    = "silly_paragraph",
+  label = "Write a silly paragraph:"
+)
+

Output:

+
+
+Figure 2: textarea Question Type
+Figure 2: +textarea Question Type +
+
+
+
+
+

3. numeric +

+

Use type = 'numeric' to specify a numeric input +type.

+

Scripts:

+
+sd_question(
+  type  = 'numeric',
+  id    = 'age',
+  label = "What's your age?"
+)
+

Output:

+
+
+Figure 3: numeric Question Type (Note there is a set of arrows on the right)
+Figure 3: +numeric Question Type (Note there is a set of arrows on +the right) +
+
+
+
+
+

4. mc +

+

Use type = 'mc' to specify a multiple choice type +question with a single choice option.

+

Scripts:

+
+sd_question(
+  type   = 'mc',
+  id     = 'artist',
+  label  = "Which artist do you prefer most from this list?",
+  option = c(
+    "Taylor Swift" = "taylor_swift",
+    "Beyoncé"      = "beyonce",
+    "Adele"        = "adele",
+    "Rihanna"      = "rihanna",
+    "Lady Gaga"    = "ladygaga",
+    "Ed Sheeran"   = "ed_sheeran",
+    "Drake"        = "drake"
+  )
+)
+

Output:

+
+
+Figure 4: mc Question Type
+Figure 4: mc +Question Type +
+
+
+
+
+

5. mc_buttons +

+

Use type = 'mc_buttons' to generate the button version +of mc.

+

Scripts:

+
+sd_question(
+  type   = 'mc_buttons',
+  id     = 'fruit',
+  label  = "Which fruit do you prefer most from this list?",
+  option = c(
+    "Apple"      = "apple",
+    "Banana"     = "banana",
+    "Pear"       = "pear",
+    "Strawberry" = "strawberry",
+    "Grape"      = "grape",
+    "Mango"      = "mango",
+    "Watermelon" = "watermelon"
+  )
+)
+

Output:

+
+
+Figure 5: mc_buttons Question Type
+Figure 5: +mc_buttons Question Type +
+
+
+
+
+

6. mc_multiple +

+

Use type = 'mc_multiple' to specify a multiple choice +type question with multiple selection enabled.

+

Scripts:

+
+sd_question(
+  type  = 'mc_multiple',
+  id    = 'swift',
+  label = "What are your favorite Taylor Swift albums (select all that apply)?",
+  option = c(
+    "Taylor Swift (2006)" = "taylor_swift",
+    "Fearless (2008)"     = "fearless",
+    "Speak Now (2010)"    = "speak_now",
+    "Red (2012)"          = "red",
+    "1989 (2014)"         = "1989",
+    "Reputation (2017)"   = "reputation",
+    "Lover (2019)"        = "lover",
+    "Folklore (2020)"     = "folklore",
+    "Evermore (2020)"     = "evermore",
+    "Midnights (2022)"    = "midnights"
+  )
+)
+

Output:

+
+
+Figure 6: mc_multiple Question Type
+Figure 6: +mc_multiple Question Type +
+
+
+
+
+

7. mc_multiple_buttons +

+

Use type = 'mc_multiple_buttons' to generate the button +version of mc_multiple.

+

Scripts:

+
+sd_question(
+  type  = 'mc_multiple_buttons',
+  id    = 'michael_jackson',
+  label = "Which are your favorite Michael Jackson songs (select all that apply)?",
+  option = c(
+    "Thriller (1982)"          = "thriller",
+    "Billie Jean (1982)"       = "billie_jean",
+    "Beat It (1982)"           = "beat_it",
+    "Man in the Mirror (1987)" = "man_in_the_mirror",
+    "Smooth Criminal (1987)"   = "smooth_criminal",
+    "Black or White (1991)"    = "black_or_white",
+    "Bad (1987)"               = "bad",
+    "Human Nature (1982)"      = "human_nature"
+  )
+)
+

Output:

+
+
+Figure 7: mc_multiple_buttons Question Type
+Figure 7: +mc_multiple_buttons Question Type +
+
+
+
+
+

8. select +

+

Use type = 'select' to specify a drop down select type +question.

+

Scripts:

+
+sd_question(
+  type  = 'select',
+  id    = 'education',
+  label = "What is the highest level of education you have attained?",
+  option = c(
+    "Did not attend high school" = "hs_no",
+    "Some high school"           = "hs_some",
+    "High school graduate"       = "hs_grad",
+    "Some college"               = "college_some",
+    "College"                    = "college_grad",
+    "Graduate Work"              = "grad",
+    "Prefer not to say"          = "no_response"
+  )
+)
+

Output:

+
+
+Figure 8: select Question Type
+Figure 8: +select Question Type +
+
+
+
+
+

9. slider (Under Construction) +

+
+

Due to compatibility issues, the slider type is still +under construction. Now the slider axis will only show numeric values +ranging from 10 to 100. We will solve this problem in our future +releases.

+
+

Use type = 'slider' to specify a slider input type.

+

Scripts:

+
+sd_question(
+  type  = 'slider',
+  id    = 'climate_care',
+  label = "To what extent do you believe human-caused climate change is real?",
+  option = c(
+    "Don't Believe"    = "dont_believe",
+    "Somewhat Believe" = "somewhat",
+    "Neutral"          = "neutral",
+    "Believe"          = "believe",
+    "Strongly Believe" = "strongly_believe"
+  )
+)
+

Output:

+
+
+Figure 9: slider Question Type for Single Slider
+Figure 9: +slider Question Type for Single Slider +
+
+
+

type = 'slider' can also be used to select a range.

+

Scripts:

+
+sd_question(
+  type     = 'slider',
+  id       = 'coldest_months',
+  label    = "What months do you think are the coldest throughout a year?",
+  option   = month.abb,
+  selected = month.abb[c(4, 8)]
+)
+

Output:

+
+
+Figure 10: slider Question Type for Two Sliders
+Figure 10: +slider Question Type for Two Sliders +
+
+
+
+
+

10. date +

+

Use type = 'date' to specify a date input type.

+

Scripts:

+
+sd_question(
+  type  = 'date',
+  id    = 'dob',
+  label = "What is your date of birth?"
+)
+

Output:

+
+
+Figure 11: date Question Type
+Figure 11: +date Question Type +
+
+
+

The date value will be today’s date by default. Upon clicking on the +text box, you are provided with a date dialog box to choose date +from.

+
+
+

11. daterange +

+

Use type = 'daterange' to specify a date range input +type.

+

Scripts:

+
+sd_question(
+  type  = 'daterange',
+  id    = 'hs_date',
+  label = "When did you start and finish high school?"
+)
+

Output:

+
+
+Figure 12: daterange Question Type
+Figure 12: +daterange Question Type +
+
+
+
+
+
+ + + +
+ + + + +
+ + + + + + + + diff --git a/articles/3_formatting_options.html b/articles/3_formatting_options.html new file mode 100644 index 00000000..66101fbf --- /dev/null +++ b/articles/3_formatting_options.html @@ -0,0 +1,266 @@ + + + + + + + +3. Formatting Options • surveydown + + + + + + + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +
+

On this page, we’ll demonstrate some of the formatting options for +displaying questions.

+
+
+

Markdown +

+

Markdown is supported for the question +label.

+

The label argument for any question type can accept +markdown formatting. For example, the question below uses the +** symbols to make some works bold.

+

Scripts:

+
+sd_question(
+  type   = 'mc',
+  id     = 'markdown_label',
+  label  = "**This** is a question *label* supporting ***markdown***:",
+  option = c(
+    "Option A" = "option_a",
+    "Option B" = "option_b",
+    "Option C" = "option_c"
+  )
+)
+

Output:

+
+

+
+

Markdown is also supported for options in +mc_buttons questions.

+

For mc_button type questions, you can also use markdown +to format the option labels.

+

Scripts:

+
+sd_question(
+  type   = 'mc_buttons',
+  id     = 'markdown_buttons',
+  label  = "The 3 options below support markdown:",
+  option = c(
+    "*Option A*"     = "option_a",
+    "**Option B**"   = "option_b",
+    "***Option C***" = "option_c"
+  )
+)
+

Output:

+
+

+
+

The same is true for mc_multiple_buttons.

+

Scripts:

+
+sd_question(
+  type   = 'mc_multiple_buttons',
+  id     = 'markdown_multiple_buttons',
+  label  = "The 3 options below support markdown:",
+  option = c(
+    "*Option A*"     = "option_a",
+    "**Option B**"   = "option_b",
+    "***Option C***" = "option_c"
+  )
+)
+

Output:

+
+

+
+
+
+

HTML +

+

HTML is supported for options of +mc_buttons and mc_multiple_buttons, so that +you can insert mixed content including plain text, markdown, and HTML +images. For example, here is a question with some complex labels for a +choice question.

+

Scripts:

+
+# Define the option vector
+html_buttons_option <- c("option_1", "option_2", "option_3")
+
+# Change the names of each element to display markdown-formatted text 
+# and an embedded image using html
+names(html_buttons_option)[1] <- "**Option 1**<br>
+    <img src='https://raw.githubusercontent.com/jhelvy/formr4conjoint/master/survey/images/fuji.jpg' width=100><br>
+    **Type**: Fuji<br>
+    **Price**: $ 2 / lb<br>
+    **Freshness**: Average"
+names(html_buttons_option)[2] <- "**Option 2**<br>
+    <img src='https://raw.githubusercontent.com/jhelvy/formr4conjoint/master/survey/images/pinkLady.jpg' width=100><br>
+    **Type**: Pink Lady<br>
+    **Price**: $ 1.5 / lb<br>
+    **Freshness**: Excellent"
+names(html_buttons_option)[3] <- "**Option 3**<br>
+    <img src='https://raw.githubusercontent.com/jhelvy/formr4conjoint/master/survey/images/honeycrisp.jpg' width=100><br>
+    **Type**: Honeycrisp<br>
+    **Price**: $ 2 / lb<br>
+    **Freshness**: Poor"
+
+sd_question(
+  type   = 'mc_buttons',
+  id     = 'html_buttons',
+  label  = "A sample survey question using `mc_buttons`",
+  option = html_buttons_option
+)
+

Output:

+
+

+
+
+
+

Width +

+

Use the width argument to change the width for the +question.

+

Scripts:

+
+sd_question(
+  type  = "textarea",
+  id    = "change_width",
+  label = "This text area has width set as 40%:",
+  width = "40%"
+)
+

Output:

+
+

+
+
+
+ + + +
+ + + + +
+ + + + + + + + diff --git a/articles/4_database_setup.html b/articles/4_database_setup.html new file mode 100644 index 00000000..70310bf1 --- /dev/null +++ b/articles/4_database_setup.html @@ -0,0 +1,145 @@ + + + + + + + +4. Database Setup • surveydown + + + + + + + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +
+

On this page, we’ll demonstrate the necessary steps to set up your +surveydown database using supabase.

+
+

Blah…

+
+ + + +
+ + + + +
+ + + + + + + + diff --git a/articles/images/1_1_mc_question.jpg b/articles/images/1_1_mc_question.jpg new file mode 100644 index 00000000..a791684d Binary files /dev/null and b/articles/images/1_1_mc_question.jpg differ diff --git a/articles/images/1_2_mc_question_other.jpg b/articles/images/1_2_mc_question_other.jpg new file mode 100644 index 00000000..9145fa83 Binary files /dev/null and b/articles/images/1_2_mc_question_other.jpg differ diff --git a/articles/images/1_3_skip_to_end.jpg b/articles/images/1_3_skip_to_end.jpg new file mode 100644 index 00000000..35a1b5d9 Binary files /dev/null and b/articles/images/1_3_skip_to_end.jpg differ diff --git a/articles/images/2_10_date.jpg b/articles/images/2_10_date.jpg new file mode 100644 index 00000000..259058b9 Binary files /dev/null and b/articles/images/2_10_date.jpg differ diff --git a/articles/images/2_11_daterange.jpg b/articles/images/2_11_daterange.jpg new file mode 100644 index 00000000..fbd51485 Binary files /dev/null and b/articles/images/2_11_daterange.jpg differ diff --git a/articles/images/2_1_text.jpg b/articles/images/2_1_text.jpg new file mode 100644 index 00000000..65144e19 Binary files /dev/null and b/articles/images/2_1_text.jpg differ diff --git a/articles/images/2_2_textarea.jpg b/articles/images/2_2_textarea.jpg new file mode 100644 index 00000000..352b1c70 Binary files /dev/null and b/articles/images/2_2_textarea.jpg differ diff --git a/articles/images/2_3_numeric.jpg b/articles/images/2_3_numeric.jpg new file mode 100644 index 00000000..c1bf4994 Binary files /dev/null and b/articles/images/2_3_numeric.jpg differ diff --git a/articles/images/2_4_mc.jpg b/articles/images/2_4_mc.jpg new file mode 100644 index 00000000..09d25e6d Binary files /dev/null and b/articles/images/2_4_mc.jpg differ diff --git a/articles/images/2_5_mc_buttons.jpg b/articles/images/2_5_mc_buttons.jpg new file mode 100644 index 00000000..9c6ed781 Binary files /dev/null and b/articles/images/2_5_mc_buttons.jpg differ diff --git a/articles/images/2_6_mc_multiple.jpg b/articles/images/2_6_mc_multiple.jpg new file mode 100644 index 00000000..236e1893 Binary files /dev/null and b/articles/images/2_6_mc_multiple.jpg differ diff --git a/articles/images/2_7_mc_multiple_buttons.jpg b/articles/images/2_7_mc_multiple_buttons.jpg new file mode 100644 index 00000000..d44f8ff3 Binary files /dev/null and b/articles/images/2_7_mc_multiple_buttons.jpg differ diff --git a/articles/images/2_8_select.jpg b/articles/images/2_8_select.jpg new file mode 100644 index 00000000..b7ae4883 Binary files /dev/null and b/articles/images/2_8_select.jpg differ diff --git a/articles/images/2_9_slider_1.jpg b/articles/images/2_9_slider_1.jpg new file mode 100644 index 00000000..58ed5bcf Binary files /dev/null and b/articles/images/2_9_slider_1.jpg differ diff --git a/articles/images/2_9_slider_2.jpg b/articles/images/2_9_slider_2.jpg new file mode 100644 index 00000000..088b5e8e Binary files /dev/null and b/articles/images/2_9_slider_2.jpg differ diff --git a/articles/images/3_1_markdown_label.jpg b/articles/images/3_1_markdown_label.jpg new file mode 100644 index 00000000..1e2fa27b Binary files /dev/null and b/articles/images/3_1_markdown_label.jpg differ diff --git a/articles/images/3_2_markdown_mc_buttons.jpg b/articles/images/3_2_markdown_mc_buttons.jpg new file mode 100644 index 00000000..4ec408ca Binary files /dev/null and b/articles/images/3_2_markdown_mc_buttons.jpg differ diff --git a/articles/images/3_3_markdown_mc_multiple_buttons.jpg b/articles/images/3_3_markdown_mc_multiple_buttons.jpg new file mode 100644 index 00000000..eafa7c02 Binary files /dev/null and b/articles/images/3_3_markdown_mc_multiple_buttons.jpg differ diff --git a/articles/images/3_4_html_mc_buttons.jpg b/articles/images/3_4_html_mc_buttons.jpg new file mode 100644 index 00000000..1621b762 Binary files /dev/null and b/articles/images/3_4_html_mc_buttons.jpg differ diff --git a/articles/images/3_5_width.jpg b/articles/images/3_5_width.jpg new file mode 100644 index 00000000..8d9b7530 Binary files /dev/null and b/articles/images/3_5_width.jpg differ diff --git a/articles/index.html b/articles/index.html new file mode 100644 index 00000000..bb0fdd40 --- /dev/null +++ b/articles/index.html @@ -0,0 +1,107 @@ + +Articles • surveydown + + +
+
+ + + +
+
+ + + +
+
+ + +
+ + + + + + + + diff --git a/authors.html b/authors.html index bf8a7d89..6371d311 100644 --- a/authors.html +++ b/authors.html @@ -1,9 +1,9 @@ -Authors and Citation • surveydownAuthors and Citation • surveydown - +
- +
- +
-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/favicon-16x16.png b/favicon-16x16.png index 091e5192..da99f4ad 100644 Binary files a/favicon-16x16.png and b/favicon-16x16.png differ diff --git a/favicon-32x32.png b/favicon-32x32.png index fe7e91b0..666555a2 100644 Binary files a/favicon-32x32.png and b/favicon-32x32.png differ diff --git a/index.html b/index.html index 65ccd681..9cfbfe09 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,7 @@ - + @@ -27,7 +27,7 @@ - +
- +
@@ -121,66 +127,36 @@

TODO Listshow_if (conditionally display question) -
  • -skip_if (conditionally skip to page)
  • -
  • -Set defaults for questions to not have any choices selected on launch.
  • -
  • -Ability to embed markdown inside choice options (like mc buttons in formr)
  • -
  • -Option for preview = TRUE (database is ignored)
  • -
  • -Export timestamps on each page in the data
  • -
  • -Export timestamps on each question interaction (since this will increase the data size considerably, maybe add this as question_times = FALSE argument)
  • -
  • -Option to start at a designated page, e.g. start_page = 'skipif' -
  • -
  • -A show_all = TRUE argument to show all the pages and hidden questions when launched (e.g. to be able to print out the entire survey text). Could also be called print_mode = TRUE.
  • -
  • -Set up SCSS to be compatible with Quarto-supported bootstrap themes
  • -
  • -Include input checks for skip_if and show_if (question_id exists, and data frame names are correct)
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • [?] Add a progress bar option in sd_config(), maybe progress_bar = 'top' or progress_bar = 'bottom' as a default, and progress_bar = 'none' to turn it off.
  • -
  • -Required questions (required = TRUE): post a popup if a question is required before allowing next button. Default should be required = FALSE.
  • -
  • -Form validation: Make sure the user inputs the correct type depending on the question type. (see https://shiny.posit.co/r/reference/shiny/0.14/validate.html)
  • -
  • -Admin page w/password (see https://github.com/daattali/shinyforms)
  • -
  • -Basic version working with a googlesheets database
  • -
  • -User tracking via url parameters: https://shinysurveys.jdtrat.com/articles/surveying-shinysurveys.html#user-tracking -
  • -
  • -Add a getSurveyData() function so the survey designer can obtain the current survey results from inside the app: https://shinysurveys.jdtrat.com/articles/get-survey-data.html -
  • +
  • +
  • +
  • +
  • +
  • +
  • Question types:
      -
    • -Multiple choice (single choice)
    • -
    • -Multiple choice (multiple choices)
    • -
    • -Select
    • -
    • -Text
    • -
    • -Numeric
    • -
    • -Multiple choice (button…like formr mc_button)
    • -
    • -Text area
    • -
    • -Date
    • -
    • -Matrix
    • -
    • -Slider
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
  • @@ -197,16 +173,11 @@

    Documentation TODO -
  • -Quick overview / basic usage
  • -
  • -List of question types and examples
  • -
  • -Question formatting options
  • -
  • -Flow control (conditional skipping and conditional display)
  • -
  • -Setting up the database with supabase
  • +
  • +
  • +
  • +
  • +
  • - - + + diff --git a/logo.png b/logo.png index ddcc0dc4..2f19e71d 100644 Binary files a/logo.png and b/logo.png differ diff --git a/news/index.html b/news/index.html new file mode 100644 index 00000000..38c6d58a --- /dev/null +++ b/news/index.html @@ -0,0 +1,107 @@ + +Changelog • surveydown + + +
    +
    + + + +
    +
    + + +
    + +
    +
    + +

    Initial version!

    +
    +
    + + + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.0.

    +
    + +
    + + + + + + + + diff --git a/pkgdown.yml b/pkgdown.yml index 96045467..ef8e5c1e 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -1,12 +1,12 @@ -pandoc: 3.1.1 -pkgdown: 2.0.7 +pandoc: 3.1.11 +pkgdown: 2.1.0 pkgdown_sha: ~ articles: 1_overview: 1_overview.html 2_question_types: 2_question_types.html 3_formatting_options: 3_formatting_options.html -last_built: 2024-07-08T01:23Z + 4_database_setup: 4_database_setup.html +last_built: 2024-07-08T01:31Z urls: reference: https://jhelvy.github.io/surveydown/reference article: https://jhelvy.github.io/surveydown/articles - diff --git a/reference/Rplot001.png b/reference/Rplot001.png new file mode 100644 index 00000000..17a35806 Binary files /dev/null and b/reference/Rplot001.png differ diff --git a/reference/figures/logo.R b/reference/figures/logo.R new file mode 100644 index 00000000..b31dfe1e --- /dev/null +++ b/reference/figures/logo.R @@ -0,0 +1,95 @@ +# Load the required packages +library(ggplot2) +library(grid) +library(Cairo) + +# Define the coordinates of the hexagon vertices +hexagon_coor <- data.frame( + x = sin(seq(0, 2 * pi, length.out = 7)), + y = -cos(seq(0, 2 * pi, length.out = 7)) +) + +# Function to create the rounded rectangle +rounded_rect <- roundrectGrob( + x = 0.5, y = 0.55, + width = 0.55, height = 0.3, + r = unit(0.1, "snpc"), + gp = gpar(fill = "white", col = "black", lwd = 10) +) + +# Function to draw the down arrow +down_arrow <- function() { + polygonGrob( + x = 0.5 + (c(0, 0.2, 0.06, 0.06, -0.06, -0.06, -0.2) * 0.5), + y = 0.45 + (c(-0.25, -0.05, -0.05, 0.2, 0.2, -0.05, -0.05) * 0.5), + gp = gpar(fill = "black", col = NA) + ) +} + +# Create the hexagon plot +logo <- ggplot() + + geom_polygon( + data = hexagon_coor, + aes(x = x, y = y), + fill = "slategray", + color = "black", + linewidth = 4 + ) + + coord_fixed() + + theme_void() + + annotation_custom( + grobTree(rounded_rect), + xmin = -0.9, xmax = 0.9, + ymin = -1, ymax = 1 + ) + + geom_text( + aes(x = -0.19, y = 0.1), + label = "S", color = "black", + size = 35, fontface = "bold", + family = "Roboto" + ) + + annotation_custom( + grobTree(down_arrow()), + xmin = -0.62, xmax = 1.05, + ymin = -0.64, ymax = 1.05 + ) + + geom_text( + aes(x = 0.01, y = -0.41, label = "surveydown"), + color = "black", + size = 13, + family = "Verdana" + ) + + geom_text( + aes(x = 0, y = -0.4, label = "surveydown"), + color = "white", + size = 13, + family = "Verdana" + ) + + # geom_richtext( + # aes(x = 0.015, y = -0.395), + # label = "surveydown", + # size = 12, family = "Verdana", + # fill = NA, label.color = NA + # ) + + # geom_richtext( + # aes(x = 0, y = -0.38), + # label = "surveydown", + # size = 12, family = "Verdana", + # fill = NA, label.color = NA + # ) + +# Call the plot +logo + +# Save +dim <- 5.6 +ggsave( + 'man/figures/logo.pdf', + logo, height = dim, width = dim, + bg = "transparent", device = cairo_pdf +) +ggsave( + 'man/figures/logo.png', + logo, height = dim, width = dim +) diff --git a/reference/figures/logo.pdf b/reference/figures/logo.pdf new file mode 100644 index 00000000..37ca19f6 Binary files /dev/null and b/reference/figures/logo.pdf differ diff --git a/reference/figures/logo.png b/reference/figures/logo.png index ddcc0dc4..2f19e71d 100644 Binary files a/reference/figures/logo.png and b/reference/figures/logo.png differ diff --git a/reference/figures/logo_old.png b/reference/figures/logo_old.png new file mode 100644 index 00000000..ddcc0dc4 Binary files /dev/null and b/reference/figures/logo_old.png differ diff --git a/reference/index.html b/reference/index.html new file mode 100644 index 00000000..92153c06 --- /dev/null +++ b/reference/index.html @@ -0,0 +1,126 @@ + +Package index • surveydown + + +
    +
    + + + +
    +
    + + + + + + + + + + + + + + + +
    +

    Package Functions

    +

    All the functions exported by the surveydown package.

    +
    +

    sd_setup()

    +

    Required Set Up Function

    +

    sd_question()

    +

    Create a survey question

    +

    sd_next()

    +

    Create a 'Next' Button for Page Navigation

    +

    sd_config()

    +

    Configuration Function for surveydown Surveys

    +

    sd_database()

    +

    Connect to a SupaBase Database

    +

    sd_server()

    +

    Server Logic for a surveydown survey

    + + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.0.

    +
    + +
    + + + + + + + + diff --git a/reference/sd_config.html b/reference/sd_config.html new file mode 100644 index 00000000..ff85b79c --- /dev/null +++ b/reference/sd_config.html @@ -0,0 +1,177 @@ + +Configuration Function for surveydown Surveys — sd_config • surveydown + + +
    +
    + + + +
    +
    + + +
    +

    This function sets up the configuration for a surveydown survey, including +page and question structures, conditional display settings, and navigation options.

    +
    + +
    +
    sd_config(
    +  skip_if = NULL,
    +  skip_if_custom = NULL,
    +  show_if = NULL,
    +  show_if_custom = NULL,
    +  preview = FALSE,
    +  start_page = NULL,
    +  show_all_pages = FALSE
    +)
    +
    + +
    +

    Arguments

    + + +
    skip_if
    +

    A list of conditions under which certain pages should be skipped. Defaults to NULL.

    + + +
    skip_if_custom
    +

    A custom function to handle conditions under which certain pages should be skipped. Defaults to NULL.

    + + +
    show_if
    +

    A list of conditions under which certain pages should be shown. Defaults to NULL.

    + + +
    show_if_custom
    +

    A custom function to handle conditions under which certain pages should be shown. Defaults to NULL.

    + + +
    preview
    +

    Logical. Whether the survey is in preview mode. Defaults to FALSE.

    + + +
    start_page
    +

    Character string. The ID of the page to start on. Defaults to NULL.

    + + +
    show_all_pages
    +

    Logical. Whether to show all pages initially. Defaults to FALSE.

    + +
    +
    +

    Value

    +

    A list containing the configuration settings for the survey, including page and question +structures, conditional display settings, and navigation options.

    +
    +
    +

    Details

    +

    The function retrieves the survey metadata, checks the validity of the conditional +display settings, and ensures that the specified start page (if any) exists. It then stores +these settings in a configuration list.

    +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +  config <- sd_config(
    +    skip_if = list(),
    +    skip_if_custom = NULL,
    +    show_if = list(),
    +    show_if_custom = NULL,
    +    preview = FALSE,
    +    start_page = "page1",
    +    show_all_pages = FALSE
    +  )
    +} # }
    +
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.0.

    +
    + +
    + + + + + + + + diff --git a/reference/sd_database.html b/reference/sd_database.html new file mode 100644 index 00000000..dcc669e0 --- /dev/null +++ b/reference/sd_database.html @@ -0,0 +1,168 @@ + +Connect to a SupaBase Database — sd_database • surveydown + + +
    +
    + + + +
    +
    + + +
    +

    This function establishes a connection to a SupaBase database using the provided +connection details.

    +
    + +
    +
    sd_database(host, db_name, port, user, table_name, password)
    +
    + +
    +

    Arguments

    + + +
    host
    +

    Character string. The host address of the SupaBase database.

    + + +
    db_name
    +

    Character string. The name of the SupaBase database.

    + + +
    port
    +

    Integer. The port number for the SupaBase database connection.

    + + +
    user
    +

    Character string. The username for the SupaBase database connection.

    + + +
    table_name
    +

    Character string. The name of the table to interact with in the SupaBase database.

    + + +
    password
    +

    Character string. The password for the SupaBase database connection.

    + +
    +
    +

    Value

    +

    A list containing the database connection object (db) and the table name (table_name).

    +
    +
    +

    Details

    +

    The function checks for the presence of all required parameters and attempts to +establish a connection to the SupaBase database. If successful, it returns a list containing +the database connection object and the table name. The user must have created the specified +table in SupaBase beforehand.

    +
    +
    +

    Note

    +

    The user must create their own table inside SupaBase in order to make additions.

    +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +  db_connection <- sd_database(
    +    host = "your-host",
    +    db_name = "your-db-name",
    +    port = 5432,
    +    user = "your-username",
    +    table_name = "your-table-name",
    +    password = "your-password"
    +  )
    +} # }
    +
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.0.

    +
    + +
    + + + + + + + + diff --git a/reference/sd_next.html b/reference/sd_next.html new file mode 100644 index 00000000..a8522387 --- /dev/null +++ b/reference/sd_next.html @@ -0,0 +1,147 @@ + +Create a 'Next' Button for Page Navigation — sd_next • surveydown + + +
    +
    + + + +
    +
    + + +
    +

    This function creates a 'Next' button for navigating to the specified next page in a surveydown survey.

    +
    + +
    +
    sd_next(next_page = NULL, label = "Next")
    +
    + +
    +

    Arguments

    + + +
    next_page
    +

    Character string. The ID of the next page to navigate to. This parameter is required.

    + + +
    label
    +

    Character string. The label of the 'Next' button. Defaults to "Next".

    + +
    +
    +

    Value

    +

    A Shiny action button UI element.

    +
    +
    +

    Details

    +

    The function generates a Shiny action button that, when clicked, sets the input value +to the specified next page ID, facilitating page navigation within the Shiny application.

    +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +  ui <- fluidPage(
    +    sd_next(next_page = "page2", label = "Next Page")
    +  )
    +  server <- function(input, output, session) {
    +    observeEvent(input$next_page, {
    +      # Navigate to the next page
    +      shinyjs::hide("page1")
    +      shinyjs::show("page2")
    +    })
    +  }
    +  shinyApp(ui, server)
    +} # }
    +
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.0.

    +
    + +
    + + + + + + + + diff --git a/reference/sd_question.html b/reference/sd_question.html new file mode 100644 index 00000000..7fb04f24 --- /dev/null +++ b/reference/sd_question.html @@ -0,0 +1,217 @@ + +Create a survey question — sd_question • surveydown + + +
    +
    + + + +
    +
    + + +
    +

    This function creates various types of survey questions.

    +
    + +
    +
    sd_question(
    +  type,
    +  id,
    +  label,
    +  cols = "80",
    +  direction = "horizontal",
    +  status = "default",
    +  width = "100%",
    +  height = "100px",
    +  selected = NULL,
    +  label_select = "Choose an option...",
    +  grid = TRUE,
    +  individual = TRUE,
    +  justified = FALSE,
    +  force_edges = TRUE,
    +  option = NULL,
    +  placeholder = NULL,
    +  required = FALSE,
    +  resize = NULL
    +)
    +
    + +
    +

    Arguments

    + + +
    type
    +

    Specifies the type of question. Possible values are "select", "mc", "mc_multiple", "mc_buttons", "mc_multiple_buttons", "text", "textarea", "numeric", "slider", "date", and "daterange". See "Details" section for more about each type.

    + + +
    id
    +

    A unique identifier for the question, which will be used as the variable name in the resulting survey data.

    + + +
    label
    +

    Character string. The label for the UI element, which can be formatted with markdown.

    + + +
    cols
    +

    Integer. Number of columns for the textarea input. Defaults to 80.

    + + +
    direction
    +

    Character string. The direction for button groups ("horizontal" or "vertical"). Defaults to "horizontal".

    + + +
    status
    +

    Character string. The status for button groups. Defaults to "default".

    + + +
    width
    +

    Character string. The width of the UI element. Defaults to "100%".

    + + +
    height
    +

    Character string. The height of the textarea input. Defaults to "100px".

    + + +
    selected
    +

    Value. The selected value(s) for certain input elements.

    + + +
    label_select
    +

    Character string. The label for the select input. Defaults to "Choose an option...".

    + + +
    grid
    +

    Logical. Whether to show a grid for slider input. Defaults to TRUE.

    + + +
    individual
    +

    Logical. Whether buttons in a group should be individually styled. Defaults to TRUE.

    + + +
    justified
    +

    Logical. Whether buttons in a group should be justified. Defaults to FALSE.

    + + +
    force_edges
    +

    Logical. Whether to force edges for slider input. Defaults to TRUE.

    + + +
    option
    +

    List. Options for the select, radio, checkbox, and slider inputs.

    + + +
    placeholder
    +

    Character string. Placeholder text for text and textarea inputs.

    + + +
    required
    +

    Logical. Whether the input is required. Defaults to FALSE.

    + + +
    resize
    +

    Character string. Resize option for textarea input. Defaults to NULL.

    + +
    +
    +

    Value

    +

    A Shiny UI element wrapped in a div with a custom data attribute for question ID.

    +
    +
    +

    Details

    +

    Insert any detailed information here, such as more details on the types of questions

    +
    + +
    +

    Examples

    +
    # Insert examples here
    +
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.0.

    +
    + +
    + + + + + + + + diff --git a/reference/sd_server.html b/reference/sd_server.html new file mode 100644 index 00000000..fc68118a --- /dev/null +++ b/reference/sd_server.html @@ -0,0 +1,166 @@ + +Server Logic for a surveydown survey — sd_server • surveydown + + +
    +
    + + + +
    +
    + + +
    +

    This function defines the server-side logic for a Shiny application, handling various +operations such as conditional display, progress tracking, page navigation, and database +updates.

    +
    + +
    +
    sd_server(input, session, config, db = NULL)
    +
    + +
    +

    Arguments

    + + +
    input
    +

    The Shiny input object.

    + + +
    session
    +

    The Shiny session object.

    + + +
    config
    +

    A list containing configuration settings for the application. Expected +elements include page_structure, page_ids, question_ids, show_if, skip_if, +skip_if_custom, show_if_custom, preview, and start_page.

    + + +
    db
    +

    An optional list containing database connection information. Expected elements +include db and table_name. Defaults to NULL.

    + +
    +
    +

    Details

    +

    The function performs the following tasks:

    • Initializes local variables based on the provided configuration.

    • +
    • Sets up reactive values to track timestamps and progress.

    • +
    • Implements conditional display logic for UI elements based on show_if and show_if_custom conditions.

    • +
    • Tracks the progress of answered questions and updates the progress bar accordingly.

    • +
    • Handles page navigation within the Shiny application, including basic and custom skip logic.

    • +
    • Performs database operations to store responses, either to a specified database or a local CSV file if in preview mode.

    • +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +  server <- function(input, output, session) {
    +    config <- list(
    +      page_structure = list(),
    +      page_ids = c("page1", "page2"),
    +      question_ids = c("q1", "q2"),
    +      show_if = NULL,
    +      skip_if = NULL,
    +      skip_if_custom = NULL,
    +      show_if_custom = NULL,
    +      preview = FALSE,
    +      start_page = "page1"
    +    )
    +    sd_server(input, session, config)
    +  }
    +  shinyApp(ui = ui, server = server)
    +} # }
    +
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.0.

    +
    + +
    + + + + + + + + diff --git a/reference/sd_setup.html b/reference/sd_setup.html new file mode 100644 index 00000000..a5c5ba8f --- /dev/null +++ b/reference/sd_setup.html @@ -0,0 +1,132 @@ + +Required Set Up Function — sd_setup • surveydown + + +
    +
    + + + +
    +
    + + +
    +

    This function is required for any surveydown survey. It sets up a Shiny application with Bootstrap 5 and initializes Shinyjs for JavaScript functionalities.

    +
    + +
    +
    sd_setup()
    +
    + +
    +

    Value

    +

    This function does not return a value. It is called for its side effects of setting up the Shiny application.

    +
    +
    +

    Details

    +

    The function configures the Shiny application to use Bootstrap 5 for styling and enables +Shinyjs for JavaScript functionalities within the application.

    +
    + +
    +

    Examples

    +
    if (FALSE) { # \dontrun{
    +  ui <- fluidPage(
    +    sd_setup(),
    +    # Your UI elements here
    +  )
    +  server <- function(input, output, session) {
    +    # Your server logic here
    +  }
    +  shinyApp(ui, server)
    +} # }
    +
    +
    +
    +
    + +
    + + +
    + +
    +

    Site built with pkgdown 2.1.0.

    +
    + +
    + + + + + + + + diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 00000000..20345639 --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,21 @@ + +https://jhelvy.github.io/surveydown/404.html +https://jhelvy.github.io/surveydown/LICENSE-text.html +https://jhelvy.github.io/surveydown/LICENSE.html +https://jhelvy.github.io/surveydown/articles/1_overview.html +https://jhelvy.github.io/surveydown/articles/2_question_types.html +https://jhelvy.github.io/surveydown/articles/3_formatting_options.html +https://jhelvy.github.io/surveydown/articles/4_database_setup.html +https://jhelvy.github.io/surveydown/articles/index.html +https://jhelvy.github.io/surveydown/authors.html +https://jhelvy.github.io/surveydown/index.html +https://jhelvy.github.io/surveydown/news/index.html +https://jhelvy.github.io/surveydown/reference/index.html +https://jhelvy.github.io/surveydown/reference/sd_config.html +https://jhelvy.github.io/surveydown/reference/sd_database.html +https://jhelvy.github.io/surveydown/reference/sd_next.html +https://jhelvy.github.io/surveydown/reference/sd_question.html +https://jhelvy.github.io/surveydown/reference/sd_server.html +https://jhelvy.github.io/surveydown/reference/sd_setup.html + +