These instructions assume you are comfortable with GitHub. If you are new to GitHub or would like a refresher, check out this guide. Key sections of the guide are also hyperlinked in the relevant steps below.
Watch this video walkthrough of us building a survey data dashboard for additional guidance, and feel free to post questions in the #qualtrics and #r-users-group Slack channels!
-
Create a new GitHub repository (repo) for your dashboard.
a. Select "Add a README file."
b. If you plan to use a virtual environment, select ".gitignore template: None."
c. If you do not plan to use a virtual environment, select ".gitignore template: R." -
Clone the repo you created in Step 1 to your computer. At this point your repo should be a single folder (the "root" directory) with a file called
README.md
in it. It will also have a hidden.gitignore
file if you selected a .gitignore template in Step 1.
a. To see your.gitignore
on Windows computer, go to Folder Properties for your repo and select "Show All File Extensions."
b. To see your.gitignore
on a Mac, use the command + shift + . keyboard shortcut. -
OPTIONAL If you want to use RStudio Projects, create your project now:
a. Open RStudio.
b. Click "File" > "New Project..." > "Existing Directory."
c. Specify your dashboard repo as the project's working directory.
d. Click "Create Project." -
OPTIONAL If you want to use a virtual environment, initialize it now:
a. Go to your dashboard repo in RStudio
b. Runinstall.packages("renv")
in your console
c. Runrenv::init()
in your console
d. Downloadrenv.lock
, which specifies dependencies for the dashboard template, and save it in your root folder. Your computer will probably ask you to confirm that you want to replace the existingrenv.lock
file, which R created when you initialized the virtual environment. You do.
e. Runrenv::restore()
in your console to activate the virtual environment. -
Download the dashboard template,
app.R
, and save it in your root folder. Do not change the file name – you need a file calledapp.R
to build a Shiny app. -
Create a folder called
www
in your root directory. (You have to name the folderwww
so Shiny will know to look there for a stylesheet.) Downloadshiny.css
and save it in your newwww
folder.
At this point, your repo should have the following structure:
YOUR_REPO_NAME/ # Whatever you named your repo in Step 1
app.R
README.md
www/
shiny.css
YOUR_REPO_NAME.Rproj # if using RStudio Projects
renv/ # if using renv
activate.R
settings.json
renv.lock # if using renv
-
Open the template,
app.R
. The template comes with "starter code" for fetching Qualtrics data and building a simple dashboard. Throughout the file,TODO
indicates where you need to provide additional code before you can run your app. Reference the demo and Shiny Basics for concrete code examples. -
When you are done adding code to
app.R
, launch your dashboard by clicking "Run App" in the top right of your source editor or runningrunApp()
in your console. -
If you want to host your dashboard online for other people to access via URL, follow these instructions to publish your app.
Acknowledgement: shiny.css
is lightly adapted from urbnthemes.