knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

moodleQuiz

Lifecycle: stable R-CMD-check codecov

R package {moodleQuiz} contains high-level functions for cleaning, encoding, filtering, and combining student's score and responses from Moodle Quiz report.

Installation

You can install the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("Lightbridge-KS/moodleQuiz")

Overview

The 4 main functions of the {moodleQuiz} are as follows:

All of theses 4 main functions are generic function that operate on data frame and list of data frames of Moodle Quiz report. The latter will be particularly useful when performing a data aggregation across multiple Moodle quiz report of the same type.

History

A long time ago, I've build a Shiny app for my colleagues to manipulate Moodle Quiz report. As the app grows bigger, I realized that I have to separate the business logic from the application logic, so that the app can be maintainable. Instead, I've focus on writing functions, and shift my aim to build system of functions to manipulate Moodle Quiz report as easy as possible for R user.

Afterwards, My collection of functions become this {moodleQuiz} package which drives the logic of this shiny app to facilitate the process of retrieve and combine student's score from SELECx (a Moodle platform from Faculty of Medicine Siriraj Hospital, Mahidol University, Thailand).

Example

library(moodleQuiz)
library(dplyr)

Let's say I have a Moodle Grades Report data frame of "Quiz_1"

glimpse(grades_ls$Quiz_1)

Combine & Adjust Grades of Quiz 1

How to choose the maximum score of each student and readjust maximum grades to 100?

Calling combine_grades() will do that in one step, plus it also cleans column names and extracts numeric student ID from Email address.

grades_ls$Quiz_1 %>%
  combine_grades(
    extract_id_from = "Email address", # Extract Student ID from Email
    id_regex = "[:digit:]+", # Regular expression to extract student ID
    choose_grade = "max", # Choose only maximum grade of each student
    new_max_grade = 100 # Adjust maximum grade to 100
  ) %>%
  select(Name, ID, starts_with("G"), starts_with("Q"))

Combine Grades for All Quizzes

Supposed in a semester student have to do a graded assignment in a multiple quizzes, you can put each individual Grades Report in a list.

Now it's a list of data frames (here as grades_ls).

grades_ls %>% 
  purrr::map_lgl(is.data.frame)

Supply a list of data frames into combine_grades(), you can combine and weight grades from multiple quizzes into one data frame with a sum of student's score in the Total_x column.

grades_ls %>% 
  combine_grades(
    extract_id_from = "Email address", # Extract Student ID from Email
    id_regex = "[:digit:]+", # Regular expression to extract student ID
    choose_grade = "max", # Choose only maximum grade of each student
    new_max_grade = c(25, 25, 50) # Adjust maximum grade to 100
  ) %>% 
  select(Name, ID, contains("Grade"), starts_with("Total"))

Learn more


Last updated: r Sys.Date()



Lightbridge-AI/moodleQuiz documentation built on Oct. 1, 2022, 9:54 p.m.