2 Preface
2.1 R packages & versioning
The R packages listed below will be necessary at some point over the course of this book. I recommend installing them all now. The block of code below is designed to first check if each of the listed packages is already installed on your computer. If any is missing, then an attempt is made to install it from CRAN. Finally, all of the packages are loaded into the environment.
## Specify the packages you'll use in the script
<- c("tidyverse",
packages "zoo",
"gridExtra",
"R.matlab",
"cowplot",
"easystats",
"circular",
"splines",
"MESS", ## area under curve
"zoo" ## rolling means
)## Now for each package listed, first check to see if the package is already
## installed. If it is installed, it's simply loaded. If not, it's downloaded
## from CRAN and then installed and loaded.
<- lapply(packages,
package.check FUN = function(x) {
if (!require(x, character.only = TRUE)) {
install.packages(x, dependencies = TRUE)
library(x, character.only = TRUE)
}
} )
I will use the sessionInfo()
command to detail the specific versions of
packages I am using (along with other information about my R session). Please
note that I am not suggesting you obtain exactly the same version of each
package listed below. Instead, the information below is meant to help you assess
whether package versioning underlies any trouble you may encounter.
## R version 4.2.2 (2022-10-31 ucrt)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 19045)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=English_United States.utf8
## [2] LC_CTYPE=English_United States.utf8
## [3] LC_MONETARY=English_United States.utf8
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United States.utf8
##
## attached base packages:
## [1] splines stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] MESS_0.5.9 circular_0.4-95 see_0.7.4 report_0.5.6
## [5] parameters_0.20.2 performance_0.10.2 modelbased_0.8.6 insight_0.19.0
## [9] effectsize_0.8.3 datawizard_0.6.5 correlation_0.8.3 bayestestR_0.13.0
## [13] easystats_0.6.0 cowplot_1.1.1 R.matlab_3.7.0 gridExtra_2.3
## [17] zoo_1.8-11 lubridate_1.9.2 forcats_1.0.0 stringr_1.5.0
## [21] dplyr_1.1.0 purrr_1.0.1 readr_2.1.4 tidyr_1.3.0
## [25] tibble_3.1.8 ggplot2_3.4.1 tidyverse_2.0.0
##
## loaded via a namespace (and not attached):
## [1] sass_0.4.5 jsonlite_1.8.4 R.utils_2.12.2 bslib_0.4.2
## [5] ggstance_0.3.6 yaml_2.3.7 backports_1.4.1 pillar_1.8.1
## [9] lattice_0.20-45 glue_1.6.2 digest_0.6.31 polyclip_1.10-4
## [13] colorspace_2.1-0 htmltools_0.5.4 Matrix_1.5-1 R.oo_1.25.0
## [17] pkgconfig_2.0.3 labelled_2.10.0 broom_1.0.3 haven_2.5.1
## [21] bookdown_0.32 xtable_1.8-4 mvtnorm_1.1-3 scales_1.2.1
## [25] tweenr_2.0.2 ggforce_0.4.1 tzdb_0.3.0 timechange_0.2.0
## [29] emmeans_1.8.4-1 farver_2.1.1 generics_0.1.3 ellipsis_0.3.2
## [33] cachem_1.0.7 withr_2.5.0 geepack_1.3.9 cli_3.6.0
## [37] magrittr_2.0.3 estimability_1.4.1 evaluate_0.20 R.methodsS3_1.8.2
## [41] fansi_1.0.4 MASS_7.3-58.2 geeM_0.10.1 tools_4.2.2
## [45] hms_1.1.2 lifecycle_1.0.3 munsell_0.5.0 compiler_4.2.2
## [49] jquerylib_0.1.4 rlang_1.0.6 ggridges_0.5.4 grid_4.2.2
## [53] rstudioapi_0.14 mosaicCore_0.9.2.1 rmarkdown_2.20 boot_1.3-28
## [57] gtable_0.3.1 R6_2.5.1 knitr_1.42 fastmap_1.1.1
## [61] utf8_1.2.3 ggformula_0.10.2 stringi_1.7.12 Rcpp_1.0.10
## [65] vctrs_0.5.2 tidyselect_1.2.0 xfun_0.37 coda_0.19-4