Skip to content

Commit

Permalink
Merge pull request #87 from egouldo/80-parameter-lookup-table
Browse files Browse the repository at this point in the history
Close #80 param lookup tables for constructed variables
  • Loading branch information
egouldo authored Aug 5, 2024
2 parents a471343 + 7041b19 commit abf4461
Show file tree
Hide file tree
Showing 29 changed files with 1,011 additions and 830 deletions.
4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export(summarise_variable_counts)
export(validate_predictions)
export(validate_predictions_df_blue_tit)
export(validate_predictions_df_euc)
import(cli)
import(dplyr)
import(ggbeeswarm)
import(ggplot2)
Expand Down Expand Up @@ -134,12 +135,11 @@ importFrom(dplyr,rename)
importFrom(dplyr,right_join)
importFrom(dplyr,select)
importFrom(dplyr,summarise)
importFrom(pointblank,col_vals_not_null)
importFrom(pointblank,stop_if_not)
importFrom(forcats,fct_relevel)
importFrom(glue,glue)
importFrom(magrittr,"%>%")
importFrom(pointblank,col_vals_not_null)
importFrom(pointblank,stop_if_not)
importFrom(purrr,keep)
importFrom(purrr,list_flatten)
importFrom(purrr,list_rbind)
Expand Down
4 changes: 2 additions & 2 deletions R/prepare_response_variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#' @param param_table A table of parameters \(mean, sd\) for *most* response variables used by analysts. This tibble is pulled from the named object exported by `ManyEcoEvo::`. but can be overwritten with the users's own `param_table` dataset.
#'
#' @return A tibble of nested list-columns
#' @details Operates on nested list-columns of data
#' @family targets-pipeline functions
#' @details Operates on nested list-columns of dataframes, where each dataframe contains the response variable data for a single analysis. The function standardises the response variable data for each analysis, and returns the modified dataset to the `data` list-column.
#' @family targets-pipeline functions.
#' @family Multi-dataset Wrapper Functions
#' @export
prepare_response_variables <- function(ManyEcoEvo,
Expand Down
2 changes: 1 addition & 1 deletion R/prepare_response_variables_yi.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' @param param_table A table of parameters \(mean, sd\) for *most* response variables used by analysts. This tibble is pulled from the named object exported by `ManyEcoEvo::`. but can be overwritten with the users's own `param_table` dataset.
#'
#' @return A tibble of nested list-columns
#' @details Operates on nested list-columns of data
#' @details Operates on nested list-columns of data. The function back-transforms the response variables from the link to the response scale for each dataset in the ManyEcoEvo dataset. The back-transformed data is stored in a list-column called `back_transformed_data`. It is useful for when wanting to conduct a meta-analysis on the response scale, e.g. for the *Eucalyptus* count data.
#' @family targets-pipeline functions
#' @family Multi-dataset Wrapper Functions
#' @export
Expand Down
4 changes: 4 additions & 0 deletions R/standardise_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#' @param dataset One of either "blue tit" or "eucalyptus"
#'
#' @return A tibble of analyst data with standardised values contained in a list-column called 'back_transformed_data'
#' @details
#' Note that for $y_i$ or out of sample predictions that are standardised, if param_table is `NA` or `NULL` for a given variable, then the response variable will not be standardised, and NA will be returned for that entry in `back_transformed_data`.
#'
#' @export
#' @family analyst-data
standardise_response <- function(dat,
Expand Down Expand Up @@ -78,6 +81,7 @@ standardise_response <- function(dat,
}else{NA}))
}

#TODO for any analyses implicitly excluded, return a message to the user
return(dat)

}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ targets::tar_read("ManyEcoEvo")
1 blue tit <tibble [174 × 38]> <tibble [174 × 54]> Zr
2 eucalyptus <tibble [128 × 38]> <tibble [128 × 61]> Zr

The script that generates the ManyEcoEvo package datasets is located in
[`ManyEcoEvo/data-raw/tar_make.R`](https://github.com/egouldo/ManyEcoEvo/blob/main/data-raw/tar_make.R).

## License

This software is licensed with the GNU GPL 3 license.
Expand Down
13 changes: 5 additions & 8 deletions README.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ The `ManyEcoEvo` package provides a suite of functions for:
- Tidying and cleaning many-analyst style data for further analysis
- Reproducing the analysis in *Gould et al.* using your own many-analyst style data

[^1]: Gould, E., Fraser, H., Parker, T. *et al.* (2023). Same data, different analysts: Variation in effect sizes due to analytical decisions in ecology and evolutionary biology \[Preprint\]. Ecology and Evolutionary Biology. https://doi.org/10.32942/X2GG62

> Note that the manuscript source-code for *Gould et al.* is located in a separate repository at <https://github.com/egouldo/ManyAnalysts>, which can be viewed at <https://egouldo.github.io/ManyAnalysts/>.
## Installation
Expand All @@ -24,8 +26,7 @@ devtools::install_github("egouldo/ManyEcoEvo")

# Regenerating the ManyEcoEvo dataset

The data processing and analysis can be freely reproduced with the help of the [`targets::`](https://github.com/ropensci/targets) package.
Please see the documentation at <https://docs.ropensci.org/targets/> for further detail.
The data processing and analysis can be freely reproduced with the help of the [`targets::`](https://github.com/ropensci/targets) package. Please see the documentation at <https://docs.ropensci.org/targets/> for further detail.

Should you wish to completely reproduce the dataset generation and analysis in *Gould et al.*, complete the following steps:

Expand All @@ -44,6 +45,8 @@ suppressPackageStartupMessages(library(targets))
targets::tar_read("ManyEcoEvo")
```

The script that generates the ManyEcoEvo package datasets is located in [`ManyEcoEvo/data-raw/tar_make.R`](https://github.com/egouldo/ManyEcoEvo/blob/main/data-raw/tar_make.R).

## License

This software is licensed with the GNU GPL 3 license.
Expand Down Expand Up @@ -71,9 +74,3 @@ A BibTeX entry for LaTeX users is
url = {https://github.com/egouldo/ManyEcoEvo},
}
```

[^1]: Gould, E., Fraser, H., Parker, T.
*et al.* (2023).
Same data, different analysts: Variation in effect sizes due to analytical decisions in ecology and evolutionary biology \[Preprint\].
Ecology and Evolutionary Biology.
https://doi.org/10.32942/X2GG62
7 changes: 4 additions & 3 deletions _targets.R
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ list(tarchetypes::tar_file_read(name = euc_reviews,
expertise_subset == "All",
collinearity_subset == "All"))),
tarchetypes::tar_quarto(name = README,
path = "README.qmd")
# tarchetypes::tar_quarto(full_analysis, "analysis/analysis_revised_data.qmd")
)
path = "README.qmd"),
tarchetypes::tar_quarto(name = README_data_raw,
path = here::here("data-raw/analysis_datasets/", "README.qmd"))
)
Loading

0 comments on commit abf4461

Please sign in to comment.