Difference between revisions of "OpasnetUtils/Drafts"

From Testiwiki
Jump to: navigation, search
(Calculations: semi-working showind saved)
(Calculations: showind works now)
 
(One intermediate revision by the same user not shown)
Line 39: Line 39:
 
   deptable <- data.frame()
 
   deptable <- data.frame()
 
   for(i in ls(name = name)) {
 
   for(i in ls(name = name)) {
     #    d <- g#et(i)
+
     d = list(get(i))[[1]]
     if(class(get(i)) == "ovariable") {
+
     if(class(d) == "ovariable") {
 
       depind <- list()
 
       depind <- list()
       if(nrow(get(i)@dependencies)>0) {
+
       if(nrow(d@dependencies)>0) {
         dep <- paste(get(i)@dependencies$Name, collapse = ", ")
+
         dep <- paste(d@dependencies$Name, collapse = ", ")
         for(k in get(i)@dependencies$Name){
+
         for(k in d@dependencies$Name){
 
           if(!exists(k)) cat(k, "does not exist.\n") else {
 
           if(!exists(k)) cat(k, "does not exist.\n") else {
 
             if(class(get(k)) != "ovariable") cat(k, "is not an ovariable.\n") else {
 
             if(class(get(k)) != "ovariable") cat(k, "is not an ovariable.\n") else {
               #              ko <- g#et(k)
+
               ko <- list(get(k)@output)[[1]]
              # We don't want to look at all Iters, but forbidden <-get() makes this tricky., so we just disable
+
               if("Iter" %in% colnames(ko)) ko$Iter <- as.factor(max(as.numeric(as.character(ko$Iter))))
              # this functionality at the moment. koIter should be replaced by ko$Iter where ko <- g#et(k)
+
               cols <- colnames(ko)
               if("Iter" %in% colnames(get(k)@output)) koIter <- as.factor(max(as.numeric(as.character(get(k)$Iter))))
 
               cols <- colnames(get(k)@output)
 
 
               if(!sources) cols <- cols[!grepl("Source$", cols)]
 
               if(!sources) cols <- cols[!grepl("Source$", cols)]
 
               if(!prevresults) cols <- cols[!grepl("Result$", cols)]
 
               if(!prevresults) cols <- cols[!grepl("Result$", cols)]
 
               for(l in cols) {
 
               for(l in cols) {
 
                 if(l %in% names(depind)) {
 
                 if(l %in% names(depind)) {
                   depind[[l]] <- union(depind[[l]], unique(get(k)@output[[l]]))
+
                   depind[[l]] <- union(depind[[l]], unique(ko[[l]]))
 
                 } else {
 
                 } else {
                   newind <- list(unique(get(k)@output[[l]]))
+
                   newind <- list(unique(ko[[l]]))
 
                   names(newind) <- l
 
                   names(newind) <- l
 
                   depind <- c(depind, newind)
 
                   depind <- c(depind, newind)
Line 69: Line 67:
 
         dep <- "No dependencies"
 
         dep <- "No dependencies"
 
       }
 
       }
       curcols <- colnames(get(i)@output)
+
       curcols <- colnames(d@output)
 
       if(!sources) curcols <- curcols[!grepl("Source$", curcols)]
 
       if(!sources) curcols <- curcols[!grepl("Source$", curcols)]
 
       if(!prevresults) curcols <- curcols[!grepl("Result$", curcols)]
 
       if(!prevresults) curcols <- curcols[!grepl("Result$", curcols)]
 
       droploc <- character()
 
       droploc <- character()
 
       for(m in curcols) {
 
       for(m in curcols) {
         if(!is.numeric(get(i)@output[[m]])) {
+
         if(!is.numeric(d@output[[m]])) {
           drops <- setdiff(depind[[m]], unique(get(i)@output[[m]]))
+
           drops <- setdiff(depind[[m]], unique(d@output[[m]]))
 
           if(length(drops>0)) {
 
           if(length(drops>0)) {
 
             droploc <- paste(
 
             droploc <- paste(

Latest revision as of 19:33, 6 June 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") # Old version that fetches all objects, depreciated and not updated.
objects.latest("Op_en6007", code_name = "diagnostics") # Functions for ovariable and model diagnostics: ovashapetest, showLoctable, binoptest
objects.latest("Op_en6007", code_name = "webropol") # Functions for operating with Webropol data
objects.latest("Op_en6007", code_name = "miscellaneous") # Functions for various tasks
objects.latest("Op_en6007", code_name = "gis") # Functions for ovariable, KML and Googl maps interactions

Rationale

Calculations

Functions for ovariable diagnostics showind has problems with get() but this version of code was acceptable [1].

+ Show code

Functions for Webropol data

+ Show code

Miscellaneous functions

+ Show code

Functions for GIS data

+ Show code

See also

References


Related files

<mfanonymousfilelist></mfanonymousfilelist>