aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--R/gmkinws.R17
-rw-r--r--data/FOCUS_2006.RDatabin21120 -> 22120 bytes
-rw-r--r--data/FOCUS_2006_Z.RDatabin51043 -> 66836 bytes
3 files changed, 12 insertions, 5 deletions
diff --git a/R/gmkinws.R b/R/gmkinws.R
index d40294d..9ef68e1 100644
--- a/R/gmkinws.R
+++ b/R/gmkinws.R
@@ -74,7 +74,7 @@ gmkinws <- R6Class("gmkinws",
add_ds = function(ds) {
self$check_ds(ds)
- if (is.na(self$ds)) self$ds <- plyr::compact(ds)
+ if (is.na(self$ds[1])) self$ds <- plyr::compact(ds)
else self$ds <- append(self$ds, plyr::compact(ds))
self$update_observed()
@@ -83,9 +83,13 @@ gmkinws <- R6Class("gmkinws",
},
update_observed = function() {
- if (is.na(self$ds[1])) self$observed = NULL
- else self$observed = na.omit(unique(unlist(sapply(self$ds, function(x)
- x$observed))))
+ observed_ds <- if (is.na(self$ds[1])) NULL
+ else na.omit(unique(unlist(sapply(self$ds, function(x) x$observed))))
+
+ observed_m <- if (is.na(self$m[1])) NULL
+ else na.omit(unique(unlist(sapply(self$m, function(x) names(x$spec)))))
+
+ self$observed = union(observed_ds, observed_m)
},
delete_ds = function(i) {
@@ -110,8 +114,11 @@ gmkinws <- R6Class("gmkinws",
add_m = function(m) {
self$check_m(m)
- if (is.na(self$m)) self$m <- plyr::compact(m)
+ if (is.na(self$m[1])) self$m <- plyr::compact(m)
else self$m = append(self$m, plyr::compact(m))
+
+ self$update_observed()
+
invisible(self)
},
diff --git a/data/FOCUS_2006.RData b/data/FOCUS_2006.RData
index 9d27ed8..9c8e30d 100644
--- a/data/FOCUS_2006.RData
+++ b/data/FOCUS_2006.RData
Binary files differ
diff --git a/data/FOCUS_2006_Z.RData b/data/FOCUS_2006_Z.RData
index cd5defb..0bb2b51 100644
--- a/data/FOCUS_2006_Z.RData
+++ b/data/FOCUS_2006_Z.RData
Binary files differ

Contact - Imprint