check_sub: Check Student Submission

View source: R/check_sub.R

check_subR Documentation

Check Student Submission

Description

check_sub() is a generic function that check student submission(s) from Moodle Quiz report(s) (i.e. Grades or Responses report). This function can encode & filter student's attempts by state (i.e., "Finished" or "In progress") and started time ("Started on" column). This function also cleans column names of Moodle Quiz report for easier manipulation, extracts student ID from "Email address" column using regular expression, and unites "First name" and "Surname" column into "Name".

Usage

check_sub(
  data,
  extract_id_from = c("Email address", "Institution", "Department", "ID number"),
  id_regex = ".*",
  sep_name = " ",
  state = c("Finished", "In progress"),
  encode = c(1, 0),
  choose_encode = c("max", "min", "all"),
  choose_time = c("first", "last", "all"),
  ...
)

Arguments

data

A data.frame or named list of data.frame of Moodle Quiz report(s) (i.e. either Grades or Responses report).

extract_id_from

(Character) Choose 1 column to extract ID from

id_regex

(Character) A regular expression used to extract ID from column (choose one) "Email address", "Institution", "Department", or "ID number" in the Moodle Quiz report. The default is ".*" meaning all characters. If your student email addresses has numeric IDs in them, try "[:digit:]+" to extract digits from the email. Note: Regular expression syntax is the same as stringr.

sep_name

A character in the new "Name" column that separate original "First name" and "Surname".

state

A character vector to match values in "State" column of the Moodle Quiz report

encode

An encoding numeric vector corresponding to state. For example: by default, in the "State" column, "Finished" values will be encoded as 1, and "In progress" will be encoded as 0.

choose_encode

A character to filter student's attempt by the encodeing.

  • "max" (default): return rows that have maximum encoding of each students.

  • "min": return rows that have minimum encoding of each students.

  • "all": no filter applied, return all rows.

choose_time

A character to filter student's attempt by started time (determined by "Started on" column in Moodle Quiz report). This filter applies after choose_encode has been applied to the data.

  • "first" (default): return rows that represent first attempt of each students.

  • "last": return rows that represent last attempt of each students.

  • "all": no filter applied, return all rows after applying choose_encode

...

argument sep_col of check_sub.list(), which indicates a character separation between names of list and "state" or "encode" columns.

Value

A data.frame, its output content is determined by class of its first argument: data.

  • If the data is a data.frame; the output is an encoded, filtered, and cleaned data.frame of Moodle Quiz report.

  • If the data is a named list of data.frame; the output is the same as previously described, but all Moodle Quiz reports are full-joined together by column "Name" and "ID". And, a new column "Total" is computed by the sum of all "...State" columns.

Examples

# Submission of Data Frame
check_sub(grades_ls$Quiz_1,
          id_regex = "[:digit:]+")

# Submission of List of DF
check_sub(grades_ls,
          id_regex = "[:digit:]+")



Lightbridge-KS/moodleQuiz documentation built on Sept. 27, 2022, 1:27 p.m.