R packages

1 R packages & libraries

Pre-packaged code and commands for you to use. Like opening a specialized program or application on your computer.

install.packages("vegan")
library(vegan)

add in text about finding other R packages and show another example.

1.1 Install tidyverse

install.packages("tidyverse")
library(tidyverse)

1.2 Errors and troubleshooting

  1. Read the error
  2. Google it!
  3. Typos are actually your friend

2 Keeping track of your session

A part of code documentation is so that someone else can run your code later. If you have specific versions of libraries and R installed, I recommend running the command below to print out information on your R session.

sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.2

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_4.2.2  fastmap_1.1.0   cli_3.6.0       tools_4.2.2    
 [5] htmltools_0.5.4 yaml_2.3.7      rmarkdown_2.20  knitr_1.42     
 [9] xfun_0.37       digest_0.6.31   jsonlite_1.8.4  rlang_1.0.6    
[13] evaluate_0.20