Search notes:

R package installation

install.packages(…)

Installing packages offline

Download the packages

pkgs <- c('shiny', 'tidyverse', 'odbc', 'ggplot2');

version <- '3.6.1';
dep_pkgs <- unlist(tools::package_dependencies(
   packages  = pkgs,
   db        = available.packages(), 
   which     = c('Depends', 'Imports'),
   recursive = TRUE
));

all_pkgs <- union(pkgs, dep_pkgs);

pkg_dir <- paste0(Sys.getenv('TEMP'), '/pkgs', '-', version);
dir.create(pkg_dir);

setwd(pkg_dir);

pkg_downloaded <- download.packages(
   pkgs    = all_pkgs,
   destdir = pkg_dir,
   type    ='win.binary',              # Change here #
   version = version
);

write.csv(
   file = 'packages.csv',
   basename(pkg_downloaded[, 2]),
   row.names = FALSE
);

Install downloaded packages

setwd('P:/to/install/dir');

pkgs <- read.csv(
  'packages.csv',
   stringsAsFactors = FALSE
)[, 1];

install.packages(
   pkgs,
   repos = NULL,
   type  ='win.binary'
);

See also

R packages

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1745511004, '3.16.10.2', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/R/packages/_installation/index(92): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78