addtoenv(simecol)
addtoenv()所属R语言包:simecol
Add Functions from a Non-nested List of Named Functions to a Common Environment
从非嵌套的命名函数列表的功能添加到一个共同的环境
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Create and set an environment where functions within a non-nested named list of functions see each other. This function is normally used within other functions.
创建和设置的环境下,非嵌套命名的函数列表函数内看到对方。此函数通常用来在其他函数。
用法----------Usage----------
addtoenv(L, p = parent.frame())
参数----------Arguments----------
参数:L
a non-nested list of named functions.
非嵌套列表命名的功能。
参数:p
the environment where the functions are assigned to. Defaults to the parent frame.
的环境下的功能被分配到。默认的父框架。
Details
详细信息----------Details----------
This function is used by the "solver functions" of simecol.
使用此功能的求解器功能的simecol。
值----------Value----------
The list of equations within a common environment.
的方程在一个共同的环境。
注意----------Note----------
This is a very special function that uses environment manipulations. Its purpose is to "open" the access to interdependend functions within a common list structure (function list).
这是一个非常特殊的功能,使用环境操作。其目的是“打开”访问内到interdependend功能一个共同的链表结构(功能列表)。
参见----------See Also----------
attach, environment
attach,environment
实例----------Examples----------
eq <- list(f1 = function(x, y) x + y,
f2 = function(a, x, y) a * f1(x, y)
)
fx <- function(eq) {
eq <- addtoenv(eq)
print(ls())
print(environment(eq$f1))
f1(3,4) + f2(1,2,3)
}
fx(eq)
## eq$f2(2,3,4) # should give an error outside fx[#式$ F2(2,3,4)应该给出一个错误外FX]
environment(eq$f2) # should return R_GlobalEnv again[,应该返回R_GlobalEnv再发生]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|