Difference between revisions of "OpasnetUtils/Drafts"

From Testiwiki
Jump to: navigation, search
(Answer)
(Answer: a bug in findrest fixed)
Line 392: Line 392:
 
{
 
{
 
# findrest input is an ovariable that can be integrated over indices cols to result in total.
 
# findrest input is an ovariable that can be integrated over indices cols to result in total.
# Often it is used with uncertain fractions. The largest fraction is omitted or NA, and it is replaced by whatever is missing from the total.
+
# Often it is used with uncertain fractions. One (often the largest) fraction is  
 +
# omitted or NA, and it is replaced by whatever is missing from the total.
 
if (nrow(X@output) == 0)  
 
if (nrow(X@output) == 0)  
 
X <- EvalOutput(X)
 
X <- EvalOutput(X)
rescol <- comment(result(X))
+
rescol <- paste(X@name, "Result", sep = "")
 
marginals <- colnames(X@output)[X@marginal]
 
marginals <- colnames(X@output)[X@marginal]
  
 
# temp is the amount that is still missing from the total.
 
# temp is the amount that is still missing from the total.
 
temp <- total - oapply(X, cols = cols, FUN = function(x) sum(x, na.rm = TRUE))
 
temp <- total - oapply(X, cols = cols, FUN = function(x) sum(x, na.rm = TRUE))
if(rescol != "Result") temp <- unkeep(temp, cols = rescol) # Remove old rescol because it would cause trouble later.
+
 
colnames(temp@output)[colnames(temp@output) == "Result"] <- "tempResult"  
+
# Remove old rescol because it would cause trouble later.
 +
if(rescol != paste(temp@name, "Result", sep = "")) temp <- unkeep(temp, cols = rescol)  
 +
colnames(temp@output)[colnames(temp@output) == paste(temp@name, "Result", sep = "")] <- "tempResult"  
 
temp@name <- "temp" # This is to make sure that merge works.
 
temp@name <- "temp" # This is to make sure that merge works.
  

Revision as of 18:02, 22 February 2015



Question

Which functions are so useful that they should be taken into OpasnetUtils package? This page contains draft function which will be included when they are good enough and found important.

Answer

Call the objects stored by this code from another rode with this command:

objects.latest("Op_en6007", code_name = "answer")

+ Show code

See also

References


Related files

<mfanonymousfilelist></mfanonymousfilelist>