Last active
November 13, 2020 15:24
-
-
Save mine-cetinkaya-rundel/88691251f95bf0c06110349453194668 to your computer and use it in GitHub Desktop.
Merging assignment scores into a format your LMS requires
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
lms_export <- tribble( | |
~Name, ~`Student ID`, ~`HW 01 [Total Pts: 100 Score] |so many more characters`, ~`and many more columns`, | |
"Dorianne Grey", 12345, NA, NA, | |
"Krista Rose", 67890, NA, NA | |
) | |
hw_scores <- tribble( | |
~student_id, ~score, | |
12345, 80, | |
67890, 75 | |
) | |
hw_var_name <- str_subset(names(lms_export), "HW 01") | |
lms_export %>% | |
select(Name:`Student ID`) %>% | |
left_join(hw_scores, by = c(`Student ID` = "student_id")) %>% | |
rename(!!hw_var_name := score) | |
#> # A tibble: 2 x 3 | |
#> Name `Student ID` `HW 01 [Total Pts: 100 Score] |so many more charac… | |
#> <chr> <dbl> <dbl> | |
#> 1 Dorianne Grey 12345 80 | |
#> 2 Krista Rose 67890 75 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment