Learn R Programming

grade (version 0.2-1)

grade.interval: Grade Intervals

Description

Checks a students interval against a correct one.

Usage

grade.interval(correctans, studentans, tolerance=0.01, useeval=TRUE, usena=FALSE, useinf=FALSE, quiet=TRUE)

Arguments

correctans
a vector of type numeric or a string
studentans
a vector of type numeric or a string
tolerance
a string or numeric representing the accepted component wise tolerance
useeval
TRUE or FALSE indicates whether or not to use 'eval' on strings
usena
usena is ignored in grade.interval. Setting to TRUE results in a warning message.
useinf
TRUE or FALSE indicating whether or not Inf and -Inf are accepted values
quiet
TRUE or FALSE. If TRUE there are more warning messages when checks fail. Can be helpful for debugging.

Value

TRUE or FALSE indicating match success or failure respectively. FALSE is also returned if studentans does not look like an interval.

Details

usena is ignored in this function. If set to true, grade.interval sets it back to false and produces a warning message. grade.interval expects correctans to be a vector of length 2, if not it errors out. If correctans is in reverse order and quiet=FALSE, grade.interval issues a warning, but continues grading.

See Also

grade grade.set grade.number

Examples

Run this code
grade.interval(c(1,2), "[1,2]") # TRUE
grade.interval(c(1,2), "[1.1,2]", tolerance=".01") # FALSE

grade.interval(c(1,pi), "(1,3.142)", tolerance=".001") # TRUE

Run the code above in your browser using DataLab