Description Usage Arguments Value Examples
View source: R/test_students.R
Useful when the teacher uses a function like function(x) and the student does something like function(X) or function(y) If the student had the first argument correct, it would not be changed.
1 | fix_first_arg_in_fun(fun, first_arg = "x")
|
fun |
the function to change |
first_arg |
the name of the first argument of the function to return, Default: x |
The original function, just with a different arg.
1 2 3 4 5 6 | fo <- function(y, ...) {
x+3
}
# fo(x=5) # errors...
fo_x <- fix_first_arg_in_fun(fo, "x")
fo_x(x=5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.