mark: Mark coursework assignment Rmd

View source: R/mark.R

markR Documentation

Mark coursework assignment Rmd

Description

For Rmd submissions of reports and other coursework. Function checks word count and inserts space for feedback.

Usage

mark(
  file = NULL,
  file_name = file,
  study = NULL,
  mark = NULL,
  rubric_grades = NULL,
  rubric = NULL,
  include_rubric_desc = F,
  feedback = F,
  fdbck_boiler_text = NULL,
  rubric_url = NULL,
  flowchart_url = NULL,
  quick_comment_url = NULL,
  count_words = !feedback,
  limit = 2000,
  include_results = F,
  results_obj = NULL,
  format_comments = T,
  collapse_chunks = F,
  color = "#b38ed2",
  text = NULL,
  install_missing_pkgs = F,
  installed_pkgs = NULL,
  preview = F
)

Arguments

file

character. Either path to .Rmd file to mark or URL from which to read the file.

file_name

character. If file= is a URL, name of file to write to.

study

character. Which study to get correct results for? Currently either "red" or "green".

mark

numeric. Total mark/grade for given assignment.

rubric

A named list containing the rubric criteria (c1, c2, etc). Each criterion should be a list with name, col, and text elements containing the name, colour, and description of the criterion, respectively.

include_rubric_desc

logical. If TRUE and if rubric_grades is a factor, grade descriptors for each marking criterion will be included in sidebar boxes.

feedback

logical. Should feedback box with marker's comments appear at the bottom of document? FALSE by default.

fdbck_boiler_text

character. Optional path to boilerplate text to be used in the Feedback sections. See details.

rubric_url

cahracter. URL to a webpage containing markng rubric/criteria/guidelines for markers' quick reference.

flowchart_url

cahracter. URL to a webpage containing report flowchart students were supposed to follow. Also for for markers' quick reference. Can be either a .html file or image.

quick_comment_url

cahracter. URL to a (Google?) spreadsheet containing quick comments for convenient marking.

count_words

logical. TRUE counts body text words and if word count exceeds limit, inserts a warning line in HTML. !feedback by default.

limit

numeric. Word count limit

include_results

logical. If TRUE, object provided to results_obj= will get inserted into a formatted box in knitted HTML. FALSE by default.

results_obj

See include_results.

format_comments

logical. If TRUE (default), comments in code chunks will be formatted in line with other marker comments.

collapse_chunks

logical. If TRUE and feedback = TRUE, adjacent code chunks will be collapsed into one to prevent multiple "code" buttons stacked on top of one another in rendered HTML. FALSE by default.

color

character. Single valid colour string (hex code or any of the values in colours()).

text

Alternative way of providing input from object rather than file. Requires file_name=

install_missing_pkgs

logical. Should packages loaded in reports but not installed on marker's machine be installed? FALSE by default.

installed_pkgs

character. Vector of installed packages. See Details.

preview

logical. If TRUE additional marking tools will be provided even for feedback = T (see details)? This is only intended to be used by teachR::preview(). FALSE by default.

rubric_grades.

Mark for each rubric criterion. Can be a factor with levels sorted from lowest mark to highest mark. See rubric and include_rubric_desc for more info.

Details

Function run with feedback = FALSE will overwrite the original Rmd file and knit it into HTML. This should be done before marking in order to automate word count, include correct results, and additional marking tools (see rubric_url, flowchart_url, and quick_comment_url). The overwritten Rmd should then be used for comments and feedback. Once done, mark(feedback = TRUE) should be run on the edited Rmd. This will output a ..._marked.html file that can be returned to students.

Initial run of mark(feedback=F) inserts an empty feedback section into Rmd with three placeholders: THE GOOD, THE BAD, and RECOMMENDATIONS. These are then replaced with boilerplate text passed to fdbck_boiler_text. If the argument is not used, function defualts to using text in file.path(path.package("teachR"), "fdbck_boilerplate.txt"). Any external file passed to the argument should follow the same structure.

If install_missing_pkgs == TRUE and installed_pkgs is NULL, a vector of installed packages will be retrieved internally. This will slow things down if the function is run iteratively so it's best to provide installed_pkgs.

In-text comments can be inserted into .Rmd file on a lew line surrounded by <–!/tag/ –>, where /tag/ is one of: warn, c1, c2, c3, c4, c5.

Value

If output .Rmd and .html files were successfully created and if count_words == TRUE, returns list of $word_count and $rendered=TRUE. If count_words == FALSE, only returns a single TRUE. Otherwise returns an error.

Examples

# first run
mark("C:/work/201000.Rmd", ...)
# then
mark("C:/work/201000.Rmd", feedback = T, ...)

mivalek/teachR documentation built on Aug. 26, 2022, 6 a.m.