swirl (version 2.4.5)

expr_creates_var: Test that a new variable has been created.

Description

Tests if the e$expr creates one new variable (of correct name if given.) If so, returns TRUE.

Usage

expr_creates_var(correctName = NULL)

Arguments

correctName

expected name of the new variable or NULL

Value

TRUE or FALSE

See Also

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

Examples

Run this code
# NOT RUN {
# Test if the user has entered an expression which creates
# a new variable of any name.
expr_creates_var()
#
# Test if the user has entered an expression which creates
# a variable named 'myNum'
#
expr_creates_var('myNum')
# }

Run the code above in your browser using DataLab