Difference between revisions of "OpasnetUtils/ComputeDependencies"

From Testiwiki
Jump to: navigation, search
(Created page with "{{method|moderator=|stub="yes"}} Category:OpasnetUtils ==Description== Uses Fetch2, EvalOutput, CheckMarginals and CheckInput to load and pre-process upstream variables. Ty...")
 
(new version)
Line 12: Line 12:
 
     showcode="1"
 
     showcode="1"
 
>
 
>
# ComputeDependencies ############ uses Fetch2, EvalOutput, CheckMarginals and CheckInput to load and pre-process upstream variables
+
# ComputeDependencies ############ uses Fetch2, EvalOutput, CheckMarginals and CheckInput to load and pre-process
# Typically seen on the first line of ovariable formula code.  
+
# upstream variables. Typically seen on the first line of ovariable formula code.  
 +
# '...' can be used for input substitution, na.rm, number of iterations (N) and others
  
ComputeDependencies <- function(dependencies) {
+
ComputeDependencies <- function(dependencies, ...) {  
 
Fetch2(dependencies)
 
Fetch2(dependencies)
for (i in dependencies$Name) {
+
for (i in as.character(dependencies$Name)) {
get(i)@output <- EvalOutput(get(i))
+
assign(i, EvalOutput(get(i), ...), envir = .GlobalEnv)
get(i)@marginals <- CheckMarginals(get(i))
+
assign(i, CheckMarginals(get(i), ...), envir = .GlobalEnv)
get(i)@output <- CheckInput(get(i))
+
assign(i, CheckInput(get(i), ...), envir = .GlobalEnv)
 
}
 
}
 
}
 
}

Revision as of 13:17, 26 June 2012

Description

Uses Fetch2, EvalOutput, CheckMarginals and CheckInput to load and pre-process upstream variables. Typically seen on the first line of ovariable formula code.

Code

- Hide code

# ComputeDependencies ############ uses Fetch2, EvalOutput, CheckMarginals and CheckInput to load and pre-process
# upstream variables. Typically seen on the first line of ovariable formula code. 
# '...' can be used for input substitution, na.rm, number of iterations (N) and others

ComputeDependencies <- function(dependencies, ...) { 
	Fetch2(dependencies)
	for (i in as.character(dependencies$Name)) {
		assign(i, EvalOutput(get(i), ...), envir = .GlobalEnv)
		assign(i, CheckMarginals(get(i), ...), envir = .GlobalEnv)
		assign(i, CheckInput(get(i), ...), envir = .GlobalEnv)
	}
}

See also