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".
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 as1
, and "In progress" will be encoded as0
.- choose_encode
A character to filter student's attempt by the
encode
ing."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
ofcheck_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:]+")
#> # A tibble: 26 × 16
#> Name ID Insti…¹ Depar…² State Encode Started Grade…³ Q1
#> <chr> <chr> <lgl> <lgl> <chr> <dbl> <dttm> <dbl> <dbl>
#> 1 Jada Ro… 017 NA NA Fini… 1 2021-06-02 08:28:00 9.47 0.26
#> 2 Ronin A… 001 NA NA Fini… 1 2021-06-02 14:21:00 9.74 0.79
#> 3 Jerry H… 002 NA NA Fini… 1 2021-06-02 16:04:00 9.47 0.26
#> 4 Nathan … 026 NA NA Fini… 1 2021-06-02 00:00:00 10 0.79
#> 5 Rohith … 024 NA NA Fini… 1 2021-06-02 14:47:00 10 0.79
#> 6 Joy Ell… 013 NA NA Fini… 1 2021-06-02 03:56:00 10 0.79
#> 7 Jeremy … 023 NA NA Fini… 1 2021-06-02 08:09:00 9.21 0.79
#> 8 Christo… 003 NA NA Fini… 1 2021-06-02 00:49:00 9.47 0.26
#> 9 Israel … 018 NA NA Fini… 1 2021-06-02 15:36:00 10 0.79
#> 10 Zubaida… 022 NA NA Fini… 1 2021-06-02 23:11:00 10 0.79
#> # … with 16 more rows, 7 more variables: Q2 <dbl>, Q3 <dbl>, Q4 <dbl>,
#> # Q5 <dbl>, Q6 <dbl>, Q7 <chr>, Q8 <dbl>, and abbreviated variable names
#> # ¹Institution, ²Department, ³Grade_10.00
# Submission of List of DF
check_sub(grades_ls,
id_regex = "[:digit:]+")
#> # A tibble: 26 × 9
#> Name ID Quiz_…¹ Quiz_…² Quiz_…³ Quiz_…⁴ Quiz_…⁵ Quiz_…⁶ Total
#> <chr> <chr> <chr> <dbl> <chr> <dbl> <chr> <dbl> <dbl>
#> 1 Jada Roquemore 017 Finish… 1 Finish… 1 Finish… 1 3
#> 2 Ronin Ali 001 Finish… 1 Finish… 1 Finish… 1 3
#> 3 Jerry Hoffpauir 002 Finish… 1 Finish… 1 Finish… 1 3
#> 4 Nathan Babbitt 026 Finish… 1 Finish… 1 Finish… 1 3
#> 5 Rohith Huynh 024 Finish… 1 Finish… 1 Finish… 1 3
#> 6 Joy Ellis 013 Finish… 1 Finish… 1 Finish… 1 3
#> 7 Jeremy Nelson 023 Finish… 1 Finish… 1 Finish… 1 3
#> 8 Christopher Dill… 003 Finish… 1 Finish… 1 Finish… 1 3
#> 9 Israel Munoz 018 Finish… 1 Finish… 1 Finish… 1 3
#> 10 Zubaida al-Attar 022 Finish… 1 Finish… 1 Finish… 1 3
#> # … with 16 more rows, and abbreviated variable names ¹Quiz_1_State,
#> # ²Quiz_1_Encode, ³Quiz_2_State, ⁴Quiz_2_Encode, ⁵Quiz_3_State,
#> # ⁶Quiz_3_Encode