Difference between revisions of "OpasnetUtils/Drafts"

From Testiwiki
Jump to: navigation, search
(Answer: showLoctable added)
(Answer: binoptest function for locating problem in ovariable indices)
Line 20: Line 20:
  
 
############## Generic functions and objects are defined first.
 
############## Generic functions and objects are defined first.
 +
 +
#####################################
 +
# This function can be used to quickly locate indices that do not match between
 +
# two ovariables and thus result in an output with 0 rows.
 +
binoptest <- function(x, y) {
 +
  if(nrow(x@output) == 0) cat(paste("Ovariable", x@name,"has 0 rows in output.\n"))
 +
  if(nrow(y@output) == 0) cat(paste("Ovariable", y@name,"has 0 rows in output.\n"))
 +
  commons <- intersect(colnames(x@output), colnames(y@output))
 +
  commons <- commons[!grepl("Result$", commons)]
 +
  cat("Ovariables have these common columns:\n")
 +
  xt <- x@output
 +
  yt <- y@output
 +
  for (i in commons) {
 +
    cat(i, "with shared locations\n")
 +
    locs <- intersect(x@output[[i[1]]], y@output[[i[1]]])
 +
    if(length(locs)>50) cat(">50 of them\n") else cat(locs, "\n")
 +
    xt <- xt[xt[[i]] %in% locs , ]
 +
    yt <- yt[yt[[i]] %in% locs , ]
 +
    cat("Rows remaining", x@name, nrow(xt), y@name, nrow(yt), "\n")
 +
  }
 +
}
  
 
#### showLoctable lists locations of each index in the evaluated ovariables in the global environment.
 
#### showLoctable lists locations of each index in the evaluated ovariables in the global environment.

Revision as of 10:48, 30 May 2017



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>