Skip to content

Instantly share code, notes, and snippets.

@sastoudt
Created June 2, 2021 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sastoudt/0e0bb2f84eca0701ebb07387c247b492 to your computer and use it in GitHub Desktop.
Save sastoudt/0e0bb2f84eca0701ebb07387c247b492 to your computer and use it in GitHub Desktop.
autograde_example_learnr
library(dplyr)
library(learnrhash)
responses <- read.csv("prelabsubmission_lab1.csv", stringsAsFactors = F) ## alternatively read straight from Google Sheets
## my Google Form was:
## timestamp (automatically collected)
## name
## copy and paste hash
## lab number (so I could use one spreadsheet for all tutorials and easily filter)
## email address (automatically collected, submission limited to smith.edu)
names(responses)[3] <- "hash"
answer_key1 <- responses[1, ] ## this was when I did lesson 1 correctly to act as a reference
responses <- responses[13:nrow(responses), ] ## I had test responses in 1-12 so that I would know how many chunks for each tutorial
## you might need to do a filter here for lab number
question_answers <- extract_questions(responses, responses$hash)
exercise_answers <- extract_exercises(responses, responses$hash)
answer_key1_exercise_answers <- extract_exercises(answer_key1, responses$hash)
answer_key1_question_answers <- extract_questions(answer_key1, responses$hash)
answer_key1_exercise_answers %>%
group_by(exercise_id) %>%
summarise(isActive = checked[1]) %>%
group_by(isActive) %>%
summarise(count = n())
unique(answer_key1_exercise_answers$exercise_id) %>% length() ## number of exercises (code chunks)
nrow(answer_key1_question_answers) ## number of questions (multiple choice)
question_answers %>%
group_by(Name) %>%
summarise(count = n()) %>%
arrange(count) %>%
View() ## I would just go through this manually, you could do something fancier
exercise_answers %>%
group_by(Name) %>%
summarise(count = n(), total = sum(correct, na.rm = T)) %>%
arrange(count) %>%
View() ## I would just go through this manually, you could do something fancier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment