AgrDataSci / ClimMobTools

@@ -65,23 +65,36 @@
Loading
65 65
    
66 66
    # get variables names from assessments
67 67
    assess <- dt[["assessments"]]
68 -
    assess <- do.call("rbind", assess[, "fields"])
69 -
    assess <- data.frame(assess, stringsAsFactors = FALSE)
70 -
    assess <- assess[!duplicated(assess[, "name"]), ]
71 -
    # the ids for assessments
72 -
    assess_id <- paste0("ASS", dt[["assessments"]][, "code"])
73 -
    # and the description
74 -
    assess_name <- dt[["assessments"]][, "desc"]
75 68
    
76 -
    # trial data
77 -
    trial <- dt[["data"]]
78 -
    # the names of questions
79 -
    looknames <- assess[, "name"]
69 +
    
70 +
    if(length(assess) > 0) {
71 +
    
72 +
      assess <- do.call("rbind", assess[, "fields"])
73 +
      assess <- data.frame(assess, stringsAsFactors = FALSE)
74 +
      assess <- assess[!duplicated(assess[, "name"]), ]
75 +
      # the ids for assessments
76 +
      assess_id <- paste0("ASS", dt[["assessments"]][, "code"])
77 +
      # and the description
78 +
      assess_name <- dt[["assessments"]][, "desc"]
79 +
      # the names of questions
80 +
      looknames <- assess[, "name"]
81 +
    
82 +
    } else {
83 +
      assess <- data.frame()
84 +
      assess_id <- character()
85 +
      assess_name <- character()
86 +
      looknames <- character()
87 +
    }
88 +
    
80 89
    # paste the ids of each assessments
81 90
    looknames <- c(regs_name,
82 91
                   paste(rep(assess_id, each = length(looknames)), 
83 92
                         looknames, sep = "_"))
84 93
    
94 +
    
95 +
    # trial data
96 +
    trial <- dt[["data"]]
97 +
    
85 98
    # get the values from the trial data
86 99
    trial <- lapply(looknames, function(x){
87 100
      i <- names(trial) %in% x
@@ -92,7 +105,7 @@
Loading
92 105
    trial <- do.call("cbind", trial)
93 106
    
94 107
    # split farmgeolocation info
95 -
    # check if geografic location is available
108 +
    # check if geographic location is available
96 109
    geoTRUE <- grepl("farmgoelocation|ubicacion", names(trial))
97 110
    
98 111
    # if is available, then split the vector as lon lat
Files Coverage
R 66.73%
Project Totals (7 files) 66.73%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading