ADA1, Installing R Packages, Fall 2023

Advanced Data Analysis 1 and 2, Stat 427/527 and Stat 428/528, Prof. Erik Erhardt, UNM

Author

Erik Erhardt

Published

January 18, 2024

Install packages we’ll use

  • This may take a while, so do only once.

Copy and paste this long code chunk into the R Console window and press [Enter]. Each package will be downloaded (along with package dependencies) and installed.

## Pre-req: R and RStudio
## Download R:
#    Windows: https://cran.r-project.org/bin/windows/base/
#    Mac:     https://cran.r-project.org/bin/macosx/
#    Win/Mac: https://www.rstudio.com/products/rstudio/download/#download
## Download RStudio Desktop:
#    https://rstudio.com/products/rstudio/download/#download

## After R and RStudio are installed, then:
#   1. start RStudio
#   2. copy/paste the code below into the console window (bottom-left window)
#   3. press [Enter].


# This script will install the required packages for R.

# Install all CRAN packages
package_list <-
  c(
    "tidyverse"
  , "openintro"
  , "remotes"
  , "GGally"
  , "Hmisc"
  , "MASS"
  , "car"
  , "emmeans"
  , "gt"
  , "knitr"
  , "multcomp"
  , "multcompView"
  , "nortest"
  , "pwr"
  , "quarto"
  , "rgl"
  , "scales"
  , "scatterplot3d"
  , "vcd"
  )

## Install the list of CRAN packages
install.packages(package_list, dependencies = TRUE, type = "binary")

# This may ask you for a CRAN repository.
#   In pop-up box, scroll to bottom to choose one in USA.
# Say No to question: "install from sources the package which needs compilation?"


## Install Erik's package from github
remotes::install_github("erikerhardt/erikmisc")
# For erikmisc...
#   If it asks to update packages (it should not ask this if you updated packages above),
#     Press 2 [Enter] for "CRAN packages only".
#   If asks about "make" command, click "Cancel".
#   If asks about "git" command, click "Cancel".