Frequently Asked Questions

Note

Have a question but don’t see an answer here? Feel free to make a post on GitHub:

Why is my survey app so slow when starting?

When a {surveydown} survey first runs, it checks for files in a _survey folder that contain the rendered content from your survey.qmd file. If any of those files are missing or if there have been changed detected in either your survey.qmd or app.R files, it will re-render your survey, which can take a bit longer. But this only happens once, and afterwards so long as no further changes have been made to your survey it will use the saved files in the _survey folder to launch your app, which will load almost instantly. So if your app launches slowly, just launch it again.

It is also important that you run your survey locally at least once after making any changes to your survey.qmd or app.R files. This will render all your survey content into the _survey folder, making it much faster when your deploy it.

How do I make a question required?

Use the required_questions argument in sd_server() to control required responses (see the required questions page for more details).

Why is my shinyapps deployment failing?

First, make sure everything is correctly defined, including your Supabase project settings and password settings. The password in your project folder should be the same as your Supabase project password (see here for how to set the password). Then, make sure your survey runs on your local machine and can successfully link with your Supabase project table. With these confirmed, your shinyapps deployment should work without problem.

If you still encounter an error (e.g., the page shows the app failed to start, or you see the page but it doesn’t run properly), try clearing your cache. The simplest way to do so is to reboot your computer. It may also help if you delete previously generated files, such as the survey.html file if you rendered it and the rsconnect folder. After re-rendering, you should be able to deploy the app without error.

Why can’t I install the package?

1. Install from the repo (recommended)

Usually, we install a package by the install.packages() function. For example:

install.packages("tidyverse")

However, this function is only effective for packages on CRAN, a database that stores the R packages. Since surveydown is still under construction, it’s not available on CRAN yet (but it will be).

Now the recommended way of installing surveydown is to install it directly from its GitHub repo:

remotes::install_github("surveydown-dev/surveydown", force = TRUE)

2. Download the source code and install locally (alternative)

If you still cannot have your package installed, it could be because that your path was managed by some package managing system like Anaconda. An alternative is to download the zip file of surveydown and install it locally.

To download the zip file, go the the surveydown repo, click on the green “Code” button and click on “Download Zip”, or simplify click on this link.

Unzip this repo, and open the surveydown.Rproj file. In your R Console panel, run this code to install:

devtools::install(force = TRUE)

How to set a password for my surveydown project, and why do I need a password?

In Supabase (the database we use for surveydown), we need a password to access the database and establish connection. In surveydown, we’ve prepared a function for you: sd_set_password(). This function helps you set up your password that can be used to connect to Supabase. It is also the password for your admin page.

Below is what sd_set_password() exactly does:

For example, say your password is MyPassword. Then you define your password by:

sd_set_password("MyPassword")

After you defined your password, restart your R session by clicking on “Session” on your menu and choose “Restart R”.

This will save your password into a newly created .Renviron file. The statement looks like this:

SURVEYDOWN_PASSWORD=MyPassword

Then, this function also adds the .Renviron file into your .gitignore file (if you want to store your project on GitHub), so that it won’t be pushed to your GitHub repo. Your password is always stored locally on your machine.

You need to make sure that this password you defined matches with your Supabase project (in this case, it should be MyPassword).

There is no defined sequence in these 2 above moves. You can define your Supabase project password first, and then define your local password using sd_set_password(), or you can do it inversely. The only thing that matters is when you attempt to connect to Supabase using your survey, these 2 passwords should match.

For more information about setting password, proceed to the password page.

Back to top