Last week, we started a new course titled “Statistical Programming and Open Science Methods”. It is being offered under the research program of TRR 266 “Accounting for Transparency” and enables students to conduct data-based research so that others can contribute and collaborate. This involves making research data and methods FAIR (findable, accessible, interoperable and reusable) and results reproducible. All the materials of the course are available on GitHub together with some notes in the README on how to use them for self-guided learning.
The course is over-booked so running a normal introduction round was not feasible. Yet, I was very interested to learn about the students’ backgrounds with respect to statistical programming and their learning objectives. Thus, I decided to construct a quick online survey using the ‘shiny’ package. In addition to collecting data, this also provided me the opportunity to show-case one of the less obvious applications of statistical programming.
The design of the survey is relatively straightforward. It asks the students about their familiarity with a set of statistical programming languages and then changes the survey dynamically to collect their assessments about their usability and how easy they are to learn. After that, it presents a list of programming-related terms and asks students to state whether they are reasonably familiar with these terms. It closes with asking students about their learning objectives for this course and gives them the opportunity to state their name.
The data is being stored in a SQLite file-based database in the directory of the shiny app. Another app accesses the data and presents a quick evaluation as well as the opportunity to download the anonymized data. You can access the survey here (submit button disabled) and the evaluation app here.
To visualize the learning objectives I used the ‘ggwordcloud’ package. Fancy looking but of limited relevance.
The code for the survey and its evaluation is part of the course’s GitHub repository. Feel free to reuse. Some things that might be relevant here:
- Watch out for SQL Injection issues. In my code, I use
DBI::sqlInterpolate()for this purpose.
- The repository contains both shiny apps (
app_results.R) in one directory. Make sure to export them as two separate shiny apps in separate folders.
- Your result app needs to have access to the database file that the survey app is writing to. When you are hosting this on your own shiny server this can be realized by the results app linking to the database file in the folder of the survey app. If you plan to host your apps on a service like ‘shinyapps.io’ then this will most likely not be feasible. In this case, you might consider switching to an external database.
- When using shiny in very large courses, your students might experience “Too many users” errors from shiny as it has a limit of 100 concurrent users for a given app. When running your own shiny server you can configure shiny to allow more users but my guess is that you will run into performance issues at some point.
This is it. Let me know your thoughts and I would be very happy to get in touch if you are reusing the code for your own class survey. Feel free to comment below. Alternatively, you can reach me via email or twitter.