Difference between revisions of "OpasnetUtils/Drafts"

From Testiwiki
Jump to: navigation, search
(Answer)
(Answer)
Line 498: Line 498:
 
}
 
}
  
objects.store(ograph, fillna, collapsemarg, MyPointKML, ova2spat, MyRmap, MyPlotKML, ovaMatrixProduct, truncateIndex, findrest)
+
unkeep <- function(X, cols = NA, sources = FALSE, prevresults = FALSE) {
 +
# unkeep drops nuisance columns from the output.
 +
# cols is a vector of column names to drop.
 +
# If sources is TRUE, all columns that end "Source" will be dropped (usually unimportant indices)
 +
# If prevresults is TRUE, all columns ending "Result" will be dropped (usually intermediate results)
 +
 +
rescol <- paste(X@name, "Result", sep = "")
 +
if(sources) cols <- c(cols, colnames(X@output)[grepl("Source$", colnames(X@output))])
 +
if(prevresults) cols <- c(cols, colnames(X@output)[grepl("Result$", colnames(X@output)) &
 +
colnames(X@output) != rescol])
 +
marginals <- colnames(X@output)[X@marginal]
 +
X@output <- X@output[!colnames(X@output) %in% cols]
 +
X@marginal <- colnames(X@output) %in% marginals
 +
return(X)
 +
}
  
cat("The following objects are stored: ograph, fillna, collapsemarg, MyPointKML, ova2spat, MyRmap, MyPlotKML, ovaMatrixProduct, truncateIndex, findrest.\n")
+
objects.store(ograph, fillna, collapsemarg, MyPointKML, ova2spat, MyRmap, MyPlotKML, ovaMatrixProduct, truncateIndex, findrest, unkeep)
 +
 
 +
cat("The following objects are stored: ograph, fillna, collapsemarg, MyPointKML, ova2spat, MyRmap, MyPlotKML, ovaMatrixProduct, truncateIndex, findrest, unkeep.\n")
  
 
</rcode>
 
</rcode>

Revision as of 19:21, 23 January 2014



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>