var_is_a: Test that the value of the expression is of a specific class.

Description Usage Arguments Value See Also Examples

View source: R/answerTests2.R

Description

Returns TRUE if a variable of the given name exists in the global environment and is of the given class.

Usage

1
var_is_a(class, var_name)

Arguments

class

expected class which the given variable

var_name

name of the variable

Value

TRUE or FALSE

See Also

Other AnswerTests: AnswerTests, any_of_exprs(), calculates_same_value(), expr_creates_var(), expr_identical_to(), expr_is_a(), expr_uses_func(), func_of_newvar_equals(), omnitest(), val_has_length(), val_matches()

Examples

1
2
3
4
5
## Not run: 
# Test that a variable named "x" in the global environmentis numeric.
var_is_a('numeric', 'x')

## End(Not run)

swirl documentation built on Jan. 16, 2020, 5:03 p.m.