Learn R Programming

compare (version 0.2-6)

questionMarks: Define a Marking Scheme

Description

These functions are used to specify how the result of a comparison between two objects should be converted to a numeric mark.

Usage

questionMarks(answerNames, maxMark, ...)
rule(answerName, falseMark, ...)
transformRule(pattern, mark)

Arguments

answerNames
The names of objects that have been compared.
maxMark
The maximum mark for the question.
answerName
The name of one object that has been compared.
falseMark
How many marks to deduct if the comparison result was FALSE.
pattern
A regular expression to search for within the comparison transformations.
mark
How many marks to deduct if the regular expression is matched.
...
For questionMarks, zero or more marking rules (as generated by the the rule() function); for rule(), zero or more transformation rules (as generated by the transformRule() function.

Value

An object of class "questionMarks".

Details

These functions are used to define a marking scheme. The function markQuestions() can then be used to apply the results to a set of comparisons, as generated by compareFiles().

See Also

markQuestions and compareFiles

Examples

Run this code
# Check a comparison involving an object called 'IndianMothers'
# Start with a mark of 1 and deduct 1 if the comparison failed
questionMarks("IndianMothers",
              maxMark=1,
              rule("IndianMothers", 1))

# Check comparisons involving several objects
# Start with a mark of 2, for each unsuccessful comparison
# deduct 1 mark, and if a comparison involving the object
# 'class' includes a coercion transformation, deduct 1 mark.
questionMarks(c("id", "age", "edu", "class"),
              maxMark=2,
              rule("id", 1),
              rule("age", 1),
              rule("edu", 1),
              rule("class", 1,
                   transformRule("coerced", 1)))

Run the code above in your browser using DataLab