$f,g\colon\mathbb{R}\longrightarrow\mathbb{R}$, it is natural to define $f+g$ as the function that maps $x\in\mathbb{R}$ to $f(x) + g(x)$. However, in base R, objects of class function do not have arithmetic methods defined, so idiom such as "f + g" returns an error, even though it has a perfectly reasonable expectation. The vfunc package offers this functionality. Other similar features are provided, which lead to compact and readable idiom. A wide class of coding bugs is eliminated.
翻译:对于函数 $f,g\colon\mathbb{R}\longrightarrow\mathbb{R}$,自然可以定义 $f+g$ 为将 $x\in\mathbb{R}$ 映射到 $f(x) + g(x)$ 的函数。然而,在基础R语言中,函数类对象未定义算术运算方法,因此诸如"f + g"这样的表达式会返回错误,尽管其具有完全合理的预期。vfunc包提供了这一功能。该包还提供了其他类似特性,使得代码表达更加简洁易读。同时,它也消除了大量编码错误。