Computationally extending the analysis.
This section is for those considering helping out with this project.
The most important thing to check is that the code does what the
manuscript says it does. Checking each target in the _targets.R
file filters to things expected and so forth.
In this process, adding comments to the code of what your understanding of what it does is very useful. Adding to the documentation of the functions would also be very helpful. Another thing to consider is renaming the targets so that the pipeline conveys the analysis steps clearer.
Code reviewers may have ideas about the site structure and documentation, as well.
Most importantly, two questions need to be assessed:
Finally, donβt forget to update the DESCRIPTION file with your ORCID as a contributor.
Code reviewers and other researchers may also wish to extend, that is, patch the script of this analysis. The rest of this document provides guidance on how to do that. A working version of R, and a willingess to learn a small set of functions, is all one needs to have in order to contribute to this analysis.
Ideally future studies are appended to the dataset so that it remains an up to date repository of all studies examining interventions for male infertility. A good example of a large-scale living analysis is Cochraneβs COVID-NMA, applying evidence synthesis to all COVID research as it comes out.
There may be a particular relevant skillset one has developed that would be a small effort but improve the analysis immensely.
The usethis::pr_
functions are a blessing for this kind of thing. For getting your
computer to talk to git, an invaluable resource (every time; every new
computer) is Happy
Git with R. Just a few functions to smooth the process of forking
and contributing to a package. It does require an investment in reading
the documentation for those few functions.
Issues are a great way of pooling knowledge. One person might have an idea for an extension, and another may know how to implement it quickly.
renv::
A frustration for analysts is often version conflicts between R
packages. This analysis uses renv::
to snapshot the
versions used for the code. The following function retrieves the correct
versions of the packages.
renv::restore()
targets::
and
tidyverse::
This analysis is implemented in tidverse::
script, and
the analysis is structured as both a package and as a make-like pipeline.
Note, in particular, that circles are code blocks, and squares represent loops.
tar_visnetwork(
# this first argument is only required for static output
# https://github.com/ropensci/targets/discussions/819
callr_arguments = list(spinner = FALSE),
targets_only = TRUE)
ββ [1mAttaching packages[22m βββββββββββββββββββββββββββββββββββββββ tidyverse 1.3.1 ββ
[32mβ[39m [34mggplot2[39m 3.3.6 [32mβ[39m [34mpurrr [39m 0.3.4
[32mβ[39m [34mtibble [39m 3.1.7 [32mβ[39m [34mdplyr [39m 1.0.9
[32mβ[39m [34mtidyr [39m 1.2.0 [32mβ[39m [34mstringr[39m 1.4.0
[32mβ[39m [34mreadr [39m 2.1.2 [32mβ[39m [34mforcats[39m 0.5.1
ββ [1mConflicts[22m ββββββββββββββββββββββββββββββββββββββββββ tidyverse_conflicts() ββ
[31mβ[39m [34mdplyr[39m::[32mfilter()[39m masks [34mstats[39m::filter()
[31mβ[39m [34mdplyr[39m::[32mlag()[39m masks [34mstats[39m::lag()
Loading required package: ggh4x
Attaching package: βjanitorβ
The following objects are masked from βpackage:statsβ:
chisq.test, fisher.test
For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores())
Attaching package: βmultinmaβ
The following objects are masked from βpackage:statsβ:
dgamma, pgamma, qgamma
Loading required package: Matrix
Attaching package: βMatrixβ
The following objects are masked from βpackage:tidyrβ:
expand, pack, unpack
Loading required package: metadat
Loading the 'metafor' package (version 3.4-0). For an
introduction to the package please type: help(metafor)
[conflicted] Will prefer [34mdplyr::filter[39m over any other package
Subsections of the pipeline can be viewed by name or by
tidyverse::
selection tools. For example, the pipeline of
head to head comparisons can be viewed thus.
tar_visnetwork(
# this first argument is only required for static output
callr_arguments = list(spinner = FALSE),
allow = starts_with("hth"))
ββ [1mAttaching packages[22m βββββββββββββββββββββββββββββββββββββββ tidyverse 1.3.1 ββ
[32mβ[39m [34mggplot2[39m 3.3.6 [32mβ[39m [34mpurrr [39m 0.3.4
[32mβ[39m [34mtibble [39m 3.1.7 [32mβ[39m [34mdplyr [39m 1.0.9
[32mβ[39m [34mtidyr [39m 1.2.0 [32mβ[39m [34mstringr[39m 1.4.0
[32mβ[39m [34mreadr [39m 2.1.2 [32mβ[39m [34mforcats[39m 0.5.1
ββ [1mConflicts[22m ββββββββββββββββββββββββββββββββββββββββββ tidyverse_conflicts() ββ
[31mβ[39m [34mdplyr[39m::[32mfilter()[39m masks [34mstats[39m::filter()
[31mβ[39m [34mdplyr[39m::[32mlag()[39m masks [34mstats[39m::lag()
Loading required package: ggh4x
Attaching package: βjanitorβ
The following objects are masked from βpackage:statsβ:
chisq.test, fisher.test
For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores())
Attaching package: βmultinmaβ
The following objects are masked from βpackage:statsβ:
dgamma, pgamma, qgamma
Loading required package: Matrix
Attaching package: βMatrixβ
The following objects are masked from βpackage:tidyrβ:
expand, pack, unpack
Loading required package: metadat
Loading the 'metafor' package (version 3.4-0). For an
introduction to the package please type: help(metafor)
[conflicted] Will prefer [34mdplyr::filter[39m over any other package
Here is the pipeline for fitting the network meta-analysis models.
Functions are documented using roxygen::2
and can be
searched using R, for example ?smd_calc
.
# fit dat and fit arms are the most relevant targets for the model implementation
tar_visnetwork(
# this first argument is only required for static output
callr_arguments = list(spinner = FALSE),
names = c("fit_dat", "fit_arms"))
ββ [1mAttaching packages[22m βββββββββββββββββββββββββββββββββββββββ tidyverse 1.3.1 ββ
[32mβ[39m [34mggplot2[39m 3.3.6 [32mβ[39m [34mpurrr [39m 0.3.4
[32mβ[39m [34mtibble [39m 3.1.7 [32mβ[39m [34mdplyr [39m 1.0.9
[32mβ[39m [34mtidyr [39m 1.2.0 [32mβ[39m [34mstringr[39m 1.4.0
[32mβ[39m [34mreadr [39m 2.1.2 [32mβ[39m [34mforcats[39m 0.5.1
ββ [1mConflicts[22m ββββββββββββββββββββββββββββββββββββββββββ tidyverse_conflicts() ββ
[31mβ[39m [34mdplyr[39m::[32mfilter()[39m masks [34mstats[39m::filter()
[31mβ[39m [34mdplyr[39m::[32mlag()[39m masks [34mstats[39m::lag()
Loading required package: ggh4x
Attaching package: βjanitorβ
The following objects are masked from βpackage:statsβ:
chisq.test, fisher.test
For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores())
Attaching package: βmultinmaβ
The following objects are masked from βpackage:statsβ:
dgamma, pgamma, qgamma
Loading required package: Matrix
Attaching package: βMatrixβ
The following objects are masked from βpackage:tidyrβ:
expand, pack, unpack
Loading required package: metadat
Loading the 'metafor' package (version 3.4-0). For an
introduction to the package please type: help(metafor)
[conflicted] Will prefer [34mdplyr::filter[39m over any other package
New targets can be appended to the pipeline that calculate the data to be fitted differently, or add a different model algorithm. These can either replace or add to the existing pipeline.