| h_append_grade_groups {tern} | R Documentation | 
Helper function for s_count_occurrences_by_grade()
Description
Helper function for s_count_occurrences_by_grade() to insert grade groupings into list with
individual grade frequencies. The order of the final result follows the order of grade_groups.
The elements under any-grade group (if any), i.e. the grade group equal to refs will be moved to
the end. Grade groups names must be unique.
Usage
h_append_grade_groups(
  grade_groups,
  refs,
  remove_single = TRUE,
  only_grade_groups = FALSE
)
Arguments
grade_groups | 
 (named   | 
refs | 
 (named   | 
remove_single | 
 (  | 
only_grade_groups | 
 (  | 
Value
Formatted list of grade groupings.
Examples
h_append_grade_groups(
  list(
    "Any Grade" = as.character(1:5),
    "Grade 1-2" = c("1", "2"),
    "Grade 3-4" = c("3", "4")
  ),
  list("1" = 10, "2" = 20, "3" = 30, "4" = 40, "5" = 50)
)
h_append_grade_groups(
  list(
    "Any Grade" = as.character(5:1),
    "Grade A" = "5",
    "Grade B" = c("4", "3")
  ),
  list("1" = 10, "2" = 20, "3" = 30, "4" = 40, "5" = 50)
)
h_append_grade_groups(
  list(
    "Any Grade" = as.character(1:5),
    "Grade 1-2" = c("1", "2"),
    "Grade 3-4" = c("3", "4")
  ),
  list("1" = 10, "2" = 5, "3" = 0)
)