fix_first_arg_in_fun: Change the first argument of a function

Description Usage Arguments Value Examples

View source: R/test_students.R

Description

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.

Usage

1
fix_first_arg_in_fun(fun, first_arg = "x")

Arguments

fun

the function to change

first_arg

the name of the first argument of the function to return, Default: x

Value

The original function, just with a different arg.

Examples

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)

talgalili/homework documentation built on July 10, 2019, 1:41 p.m.