Dataset articulation
Showing 8 of 18 files from the diff.
R/portalcast.R
changed.
R/models_jags.R
changed.
R/prefab_models.R
changed.
R/fill_dir.R
changed.
R/prepare_rodents.R
changed.
R/orchestrate.R
changed.
R/figures.R
changed.
R/prepare_models.R
changed.
Other files ignored by Codecov
code_development/development_space.R
has changed.
DESCRIPTION
has changed.
tests/testthat/test-17-figures.R
has changed.
inst/extdata/prefab_model_controls.yaml
has changed.
NEWS.md
has changed.
man/directory-filling.Rd
has changed.
README.md
has changed.
@@ -49,7 +49,12 @@
Loading
49 | 49 | # |
|
50 | 50 | # the datasets here should come from the models selected |
|
51 | 51 | # and not as an argument ... or? maybe not? idk. think this out. |
|
52 | - | # |
|
52 | + | # i think so |
|
53 | + | # should the start and end time also come from somewhere else? |
|
54 | + | # well, here the end moon is what is looped over |
|
55 | + | # not sure this is what i want to happen more generally, tho |
|
56 | + | # we want portalcast to iterate over individual casts, but generally |
|
57 | + | # i think we want to create a recipe list or something |
|
53 | 58 | ||
54 | 59 | return_if_null(models) |
|
55 | 60 |
@@ -78,7 +83,8 @@
Loading
78 | 83 | } |
|
79 | 84 | ||
80 | 85 | if (end_moons[nend_moons] != last_moon) { |
|
81 | - | # this maybe should happen within cast? |
|
86 | + | # this maybe should happen within cast? or maybe we can sidestep it |
|
87 | + | # yeah, i would like to avoid refilling the data so many times, how to do? |
|
82 | 88 | messageq(message_break(), "\nResetting data to most up-to-date versions\n", message_break(), quiet = quiet) |
|
83 | 89 | ||
84 | 90 | fill_data(main = main, |
@@ -117,7 +117,7 @@
Loading
117 | 117 | total = TRUE, |
|
118 | 118 | nadot = TRUE) |
|
119 | 119 | temp_species <- read_model_controls(main = main, settings = settings)$jags_logistic_competition$species |
|
120 | - | if (temp_species == "all") { |
|
120 | + | if (length(temp_species) == 1 && temp_species == "all") { |
|
121 | 121 | species <- species |
|
122 | 122 | } else { |
|
123 | 123 | species <- species[species %in% temp_species] |
@@ -405,7 +405,7 @@
Loading
405 | 405 | total = TRUE, |
|
406 | 406 | nadot = TRUE) |
|
407 | 407 | temp_species <- read_model_controls(main = main, settings = settings)$jags_logistic_competition_covariates$species |
|
408 | - | if (temp_species == "all") { |
|
408 | + | if (length(temp_species) == 1 && temp_species == "all") { |
|
409 | 409 | species <- species |
|
410 | 410 | } else { |
|
411 | 411 | species <- species[species %in% temp_species] |
@@ -692,7 +692,7 @@
Loading
692 | 692 | total = TRUE, |
|
693 | 693 | nadot = TRUE) |
|
694 | 694 | temp_species <- read_model_controls(main = main, settings = settings)$jags_logistic_covariates$species |
|
695 | - | if (temp_species == "all") { |
|
695 | + | if (length(temp_species) == 1 && temp_species == "all") { |
|
696 | 696 | species <- species |
|
697 | 697 | } else { |
|
698 | 698 | species <- species[species %in% temp_species] |
@@ -964,7 +964,7 @@
Loading
964 | 964 | total = TRUE, |
|
965 | 965 | nadot = TRUE) |
|
966 | 966 | temp_species <- read_model_controls(main = main, settings = settings)$jags_logistic$species |
|
967 | - | if (temp_species == "all") { |
|
967 | + | if (length(temp_species) == 1 && temp_species == "all") { |
|
968 | 968 | species <- species |
|
969 | 969 | } else { |
|
970 | 970 | species <- species[species %in% temp_species] |
@@ -1215,7 +1215,7 @@
Loading
1215 | 1215 | total = TRUE, |
|
1216 | 1216 | nadot = TRUE) |
|
1217 | 1217 | temp_species <- read_model_controls(main = main, settings = settings)$jags_RW$species |
|
1218 | - | if (temp_species == "all") { |
|
1218 | + | if (length(temp_species) == 1 && temp_species == "all") { |
|
1219 | 1219 | species <- species |
|
1220 | 1220 | } else { |
|
1221 | 1221 | species <- species[species %in% temp_species] |
@@ -132,7 +132,7 @@
Loading
132 | 132 | nadot = TRUE) |
|
133 | 133 | ||
134 | 134 | temp_species <- read_model_controls(main = main, settings = settings)$AutoArima$species |
|
135 | - | if (temp_species == "all") { |
|
135 | + | if (length(temp_species) == 1 && temp_species == "all") { |
|
136 | 136 | species <- species |
|
137 | 137 | } else { |
|
138 | 138 | species <- species[species %in% temp_species] |
@@ -232,7 +232,7 @@
Loading
232 | 232 | total = TRUE, |
|
233 | 233 | nadot = TRUE) |
|
234 | 234 | temp_species <- read_model_controls(main = main, settings = settings)$NaiveArima$species |
|
235 | - | if (temp_species == "all") { |
|
235 | + | if (length(temp_species) == 1 && temp_species == "all") { |
|
236 | 236 | species <- species |
|
237 | 237 | } else { |
|
238 | 238 | species <- species[species %in% temp_species] |
@@ -330,7 +330,7 @@
Loading
330 | 330 | total = TRUE, |
|
331 | 331 | nadot = TRUE) |
|
332 | 332 | temp_species <- read_model_controls(main = main, settings = settings)$ESSS$species |
|
333 | - | if (temp_species == "all") { |
|
333 | + | if (length(temp_species) == 1 && temp_species == "all") { |
|
334 | 334 | species <- species |
|
335 | 335 | } else { |
|
336 | 336 | species <- species[species %in% temp_species] |
@@ -427,7 +427,7 @@
Loading
427 | 427 | total = TRUE, |
|
428 | 428 | nadot = TRUE) |
|
429 | 429 | temp_species <- read_model_controls(main = main, settings = settings)$nbGARCH$species |
|
430 | - | if (temp_species == "all") { |
|
430 | + | if (length(temp_species) == 1 && temp_species == "all") { |
|
431 | 431 | species <- species |
|
432 | 432 | } else { |
|
433 | 433 | species <- species[species %in% temp_species] |
@@ -537,7 +537,7 @@
Loading
537 | 537 | total = TRUE, |
|
538 | 538 | nadot = TRUE) |
|
539 | 539 | temp_species <- read_model_controls(main = main, settings = settings)$nbsGARCH$species |
|
540 | - | if (temp_species == "all") { |
|
540 | + | if (length(temp_species) == 1 && temp_species == "all") { |
|
541 | 541 | species <- species |
|
542 | 542 | } else { |
|
543 | 543 | species <- species[species %in% temp_species] |
@@ -670,7 +670,7 @@
Loading
670 | 670 | total = TRUE, |
|
671 | 671 | nadot = TRUE) |
|
672 | 672 | temp_species <- read_model_controls(main = main, settings = settings)$pevGARCH$species |
|
673 | - | if (temp_species == "all") { |
|
673 | + | if (length(temp_species) == 1 && temp_species == "all") { |
|
674 | 674 | species <- species |
|
675 | 675 | } else { |
|
676 | 676 | species <- species[species %in% temp_species] |
@@ -26,7 +26,7 @@
Loading
26 | 26 | #' |
|
27 | 27 | #' @param quiet \code{logical} indicator if progress messages should be quieted. |
|
28 | 28 | #' |
|
29 | - | #' @param verbose \code{logical} indicator of whether or not to print out all of the information (and thus just the tidy messages). |
|
29 | + | #' @param verbose \code{logical} indicator of whether or not to print out all of the information or just the tidy messages. |
|
30 | 30 | #' |
|
31 | 31 | #' @return \code{NULL}, \code{\link[base]{invisible}}-ly. |
|
32 | 32 | #' |
@@ -198,30 +198,30 @@
Loading
198 | 198 | #' @export |
|
199 | 199 | #' |
|
200 | 200 | prepare_dataset <- function(name = "all", |
|
201 | - | main = ".", |
|
202 | - | settings = directory_settings(), |
|
203 | - | filename = "rodents_all.csv", |
|
204 | - | clean = FALSE, |
|
205 | - | level = "Site", |
|
206 | - | type = "Rodents", |
|
207 | - | plots = "all", |
|
208 | - | unknowns = FALSE, |
|
209 | - | shape = "crosstab", |
|
210 | - | time = "newmoon", |
|
211 | - | output = "abundance", |
|
212 | - | fillweight = FALSE, |
|
213 | - | treatment = NULL, |
|
214 | - | na_drop = FALSE, |
|
215 | - | zero_drop = FALSE, |
|
216 | - | min_traps = 1, |
|
217 | - | min_plots = 24, |
|
218 | - | effort = TRUE, |
|
219 | - | species = base_species(), |
|
220 | - | total = TRUE, |
|
221 | - | save = TRUE, |
|
222 | - | overwrite = TRUE, |
|
223 | - | quiet = FALSE, |
|
224 | - | verbose = FALSE) { |
|
201 | + | main = ".", |
|
202 | + | settings = directory_settings(), |
|
203 | + | filename = "rodents_all.csv", |
|
204 | + | clean = FALSE, |
|
205 | + | level = "Site", |
|
206 | + | type = "Rodents", |
|
207 | + | plots = "all", |
|
208 | + | unknowns = FALSE, |
|
209 | + | shape = "crosstab", |
|
210 | + | time = "newmoon", |
|
211 | + | output = "abundance", |
|
212 | + | fillweight = FALSE, |
|
213 | + | treatment = NULL, |
|
214 | + | na_drop = FALSE, |
|
215 | + | zero_drop = FALSE, |
|
216 | + | min_traps = 1, |
|
217 | + | min_plots = 24, |
|
218 | + | effort = TRUE, |
|
219 | + | species = base_species(), |
|
220 | + | total = TRUE, |
|
221 | + | save = TRUE, |
|
222 | + | overwrite = TRUE, |
|
223 | + | quiet = FALSE, |
|
224 | + | verbose = FALSE) { |
|
225 | 225 | ||
226 | 226 | return_if_null(name) |
|
227 | 227 |
@@ -1,6 +1,3 @@
Loading
1 | - | # These functions are to be pulled out into the directory orchestration package |
|
2 | - | ||
3 | - | ||
4 | 1 | #' @title Create the Structure of a Directory and Fill with Content |
|
5 | 2 | #' |
|
6 | 3 | #' @description Instantiates the necessary folder structure for a directory, writes the setup configuration file, and fills the directory with core content. |
@@ -40,8 +37,12 @@
Loading
40 | 37 | settings = directory_settings(), |
|
41 | 38 | quiet = FALSE){ |
|
42 | 39 | ||
40 | + | core_package_version <- package_version_finder("setup_dir") |
|
41 | + | ||
42 | + | messageq(message_break(), "\nThis is ", core_package_version[["package"]], " v", core_package_version[["version"]], " ", format(Sys.time(), "%x %T %Z"), "\n", message_break(), quiet = quiet) |
|
43 | 43 | messageq(message_break(), "\nEstablishing directory at\n ", normalizePath(file.path(main = main), mustWork = FALSE), "\n", message_break(), quiet = quiet) |
|
44 | 44 | ||
45 | + | ||
45 | 46 | mapply(FUN = dir.create, |
|
46 | 47 | path = file.path(main, settings$subdirectories), |
|
47 | 48 | recursive = TRUE, |
@@ -51,6 +52,7 @@
Loading
51 | 52 | settings = settings, |
|
52 | 53 | quiet = quiet) |
|
53 | 54 | ||
55 | + | messageq(message_break(), "\nDirectory successfully instantiated\n", message_break(), quiet = quiet) |
|
54 | 56 | ||
55 | 57 | } |
|
56 | 58 |
@@ -67,11 +69,6 @@
Loading
67 | 69 | quiet = FALSE, |
|
68 | 70 | verbose = FALSE) { |
|
69 | 71 | ||
70 | - | core_package_version <- package_version_finder("setup_dir") |
|
71 | - | ||
72 | - | ||
73 | - | messageq(message_break(), "\nThis is ", core_package_version[["package"]], " v", core_package_version[["version"]], quiet = quiet) |
|
74 | - | messageq(" ", format(Sys.time(), "%x %T %Z"), "\n", message_break(), quiet = quiet) |
|
75 | 72 | ||
76 | 73 | create_dir(main = main, |
|
77 | 74 | settings = settings, |
@@ -84,7 +81,6 @@
Loading
84 | 81 | quiet = quiet, |
|
85 | 82 | verbose = verbose) |
|
86 | 83 | ||
87 | - | messageq(message_break(), "\nDirectory successfully instantiated\n", message_break(), quiet = quiet) |
|
88 | 84 | ||
89 | 85 | read_directory_configuration(main = main, |
|
90 | 86 | settings = settings, |
@@ -972,11 +972,20 @@
Loading
972 | 972 | ||
973 | 973 | obs <- read_rodents_table(main = main, |
|
974 | 974 | settings = settings, |
|
975 | - | dataset = gsub("_interp", "", casts_meta$dataset)) |
|
975 | + | dataset = gsub("dm_", "", gsub("_interp", "", casts_meta$dataset))) |
|
976 | 976 | colnames(obs) <- gsub("\\.", "", colnames(obs)) |
|
977 | 977 | ||
978 | 978 | sp_col <- is_sp_col(obs, nadot = TRUE, total = TRUE) |
|
979 | 979 | species <- ifnull(species, colnames(obs)[sp_col]) |
|
980 | + | ||
981 | + | mod_control <- read_model_controls(main = main, settings = settings) |
|
982 | + | model <- ifnull(model, names(mod_control)[1]) |
|
983 | + | temp_species <- mod_control[[model]]$species |
|
984 | + | if (length(temp_species) == 1 && temp_species == "all") { |
|
985 | + | species <- species |
|
986 | + | } else { |
|
987 | + | species <- species[species %in% temp_species] |
|
988 | + | } |
|
980 | 989 | if (length(species) > 1) { |
|
981 | 990 | if ("total" %in% species) { |
|
982 | 991 | species <- "total" |
@@ -993,7 +1002,7 @@
Loading
993 | 1002 | } |
|
994 | 1003 | ||
995 | 1004 | obs <- obs[ , c("newmoonnumber", species)] |
|
996 | - | dataset <- gsub("_interp", "", casts_meta$dataset) |
|
1005 | + | dataset <- gsub("dm_", "", gsub("_interp", "", casts_meta$dataset)) |
|
997 | 1006 | ||
998 | 1007 | if (!is.null(model) && tolower(model) == "ensemble") { |
|
999 | 1008 |
@@ -36,17 +36,18 @@
Loading
36 | 36 | ||
37 | 37 | nmodels <- length(models) |
|
38 | 38 | ||
39 | - | if (nmodels == 1) { |
|
40 | - | ||
41 | - | read_model_controls(main = main, |
|
42 | - | settings = settings)[[models]] |
|
43 | - | ||
44 | - | } else if (nmodels > 1) { |
|
39 | + | # want to cut this commented part out but need to make sure it will still work fine or figure out where i need to fix it |
|
40 | + | # if (nmodels == 1) { |
|
41 | + | # |
|
42 | + | # read_model_controls(main = main, |
|
43 | + | # settings = settings)[[models]] |
|
44 | + | # |
|
45 | + | # } else if (nmodels > 1) { |
|
45 | 46 | ||
46 | 47 | read_model_controls(main = main, |
|
47 | 48 | settings = settings)[models] |
|
48 | 49 | ||
49 | - | } |
|
50 | + | # } |
|
50 | 51 | ||
51 | 52 | } |
|
52 | 53 |
Files | Coverage |
---|---|
R | 93.46% |
Project Totals (22 files) | 93.46% |
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.