Skip to content

Commit

Permalink
fix #41 mv expert_subset into pkg internals:
Browse files Browse the repository at this point in the history
 echo E63AF5C2 && echo ignoreboth && /usr/bin/env && echo 5673D7C1
  • Loading branch information
egouldo committed Jun 14, 2024
1 parent 247771c commit f93c497
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion R/generate_collinearity_subset.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' prepare_response_variables(estimate_type = "Zr") |>
#' generate_exclusion_subsets(estimate_type = "Zr") |>
#' generate_rating_subsets() |>
#' generate_expertise_subsets(expert_subset) |>
#' generate_expertise_subsets(ManyEcoEvo:::expert_subset) |>
#' generate_collinearity_subset(collinearity_subset = collinearity_subset)
generate_collinearity_subset <- function(ManyEcoEvo, collinearity_subset) {
# Check if the inputs are a dataframe
Expand Down
4 changes: 1 addition & 3 deletions R/generate_expertise_subsets.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
#' library(ManyEcoEvo)
#' library(tidyverse)
#' library(targets)
#' targets::tar_load(ManyEcoEvo)
#' targets::tar_load(expert_subset)
#' ManyEcoEvo %>%
#' prepare_response_variables(estimate_type = "Zr") |>
#' generate_exclusion_subsets(estimate_type = "Zr") |>
#' generate_rating_subsets() |>
#' generate_expertise_subsets(expert_subset)
#' generate_expertise_subsets(ManyEcoEvo:::expert_subset)
generate_expertise_subsets <- function(ManyEcoEvo, expert_subset) {
#TODO idea, allow ellipses arg in function and pass those expressions to filter.
# that way isn't hardcoded in the function. Repeat for all other generate / exclude map funs
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
5 changes: 1 addition & 4 deletions _targets.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ list(tarchetypes::tar_file_read(name = euc_reviews,
tarchetypes::tar_file_read(name = list_of_new_prediction_files,
command = "data-raw/analyst_data/S2/list_of_new_csv_files.csv",
read = readr::read_csv(!!.x)),
tarchetypes::tar_file_read(name = expert_subset,
command = "data-raw/metadata_and_key_data/Good_Statistician_ResponseIds.csv",
read = readr::read_csv(file = !!.x)),
targets::tar_target(name = all_review_data,
command = prepare_review_data(bt_reviews,euc_reviews)),
targets::tar_target(ManyEcoEvo,
Expand All @@ -79,7 +76,7 @@ list(tarchetypes::tar_file_read(name = euc_reviews,
prepare_response_variables(estimate_type = "Zr") |>
generate_exclusion_subsets(estimate_type = "Zr") |>
generate_rating_subsets() |>
generate_expertise_subsets(expert_subset) |>
generate_expertise_subsets(ManyEcoEvo:::expert_subset) |>
generate_collinearity_subset(ManyEcoEvo:::collinearity_subset) |>
compute_MA_inputs(estimate_type = "Zr") |>
generate_outlier_subsets() |> # TODO run before MA_inputs? diversity indices need to be recalculated!!
Expand Down
14 changes: 12 additions & 2 deletions data-raw/create_internal_pkg_data.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# ------- Create tibble of analysis IDs of analyses with collinear variables -------

library(here)
library(tidyverse)
library(usethis)
library(ManyEcoEvo)

# ----- Load Expert Subset -----

expert_subset <- readr::read_csv(here::here("data-raw",
"metadata_and_key_data",
"Good_Statistician_ResponseIds.csv"))

# ------- Create tibble of analysis IDs of analyses with highly collinear variables -------

collinearity_subset <-
tibble::tribble(
~response_id, ~id_col, ~dataset,
Expand All @@ -30,6 +38,8 @@ collinearity_subset <-
# alternatively, devtools::load_all() is needed to access the fns to build `analysis_data_param_tables`
# devtools::load_all() #TODO

#TODO consider moving *_data creation into this script to avoid dependence on pkg before built..

analysis_data_param_tables <-
bind_rows(
make_param_table(ManyEcoEvo::blue_tit_data) %>%
Expand All @@ -40,4 +50,4 @@ analysis_data_param_tables <-

# ------- Write data internally -------

usethis::use_data(analysis_data_param_tables, collinearity_subset, internal = TRUE, overwrite = TRUE)
usethis::use_data(expert_subset, analysis_data_param_tables, collinearity_subset, internal = TRUE, overwrite = TRUE)
2 changes: 1 addition & 1 deletion man/generate_collinearity_subset.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions man/generate_expertise_subsets.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f93c497

Please sign in to comment.