Skip to contents

Check and install R packages

Usage

check_r(packages, lib = .libPaths()[1], force = FALSE, verbose = TRUE)

Arguments

packages

Package to be installed. Package source can be CRAN, Bioconductor or Github. By default, the package name is extracted according to the packages parameter.

lib

The location of the library directories where to install the packages.

force

Whether to force the installation of packages. Default is FALSE.

verbose

Whether to print the message. Default is TRUE.

Examples

check_r(c("Seurat", "reticulate"))
#>  [2025-09-20 14:01:57] Installing: Seurat...
#>  
#> → Will install 40 packages.
#> → All 40 packages (0 B) are cached.
#> + ROCR               1.0-11 
#> + RcppHNSW           0.6.0  
#> + RcppTOML           0.2.3  
#> + Seurat             5.3.0  
#> + SeuratObject       5.2.0  
#> + caTools            1.18.3 
#> + deldir             2.0-4  
#> + dotCall64          1.2    
#> + fastDummies        1.7.5  
#> + fitdistrplus       1.2-4  
#> + future             1.67.0 
#> + future.apply       1.20.0 
#> + globals            0.18.0 
#> + goftest            1.2-3  
#> + gplots             3.2.0  
#> + gtools             3.9.5  
#> + here               1.0.2  
#> + ica                1.0-3  
#> + leidenbase         0.1.35 
#> + listenv            0.9.1  
#> + lmtest             0.9-40 
#> + miniUI             0.1.2  
#> + parallelly         1.45.1 
#> + pbapply            1.7-4  
#> + progressr          0.16.0 
#> + reticulate         1.43.0  +  python3
#> + rprojroot          2.1.1  
#> + scattermore        1.2    
#> + sctransform        0.4.2  
#> + sp                 2.2-0  
#> + spam               2.11-1 
#> + spatstat.data      3.1-8  
#> + spatstat.explore   3.5-2  
#> + spatstat.geom      3.5-0  
#> + spatstat.random    3.4-1  
#> + spatstat.sparse    3.1-0  
#> + spatstat.univar    3.1-4  
#> + spatstat.utils     3.1-5  
#> + tensor             1.5.1  
#> + zoo                1.8-14 
#>  All system requirements are already installed.
#>   
#>  No downloads are needed, 40 pkgs are cached
#>  Got deldir 2.0-4 (x86_64-pc-linux-gnu-ubuntu-24.04) (278.91 kB)
#>  Got fastDummies 1.7.5 (x86_64-pc-linux-gnu-ubuntu-24.04) (41.76 kB)
#>  Got dotCall64 1.2 (x86_64-pc-linux-gnu-ubuntu-24.04) (31.26 kB)
#>  Got caTools 1.18.3 (x86_64-pc-linux-gnu-ubuntu-24.04) (205.11 kB)
#>  Got globals 0.18.0 (x86_64-pc-linux-gnu-ubuntu-24.04) (158.33 kB)
#>  Got lmtest 0.9-40 (x86_64-pc-linux-gnu-ubuntu-24.04) (403.49 kB)
#>  Got future 1.67.0 (x86_64-pc-linux-gnu-ubuntu-24.04) (965.33 kB)
#>  Got gplots 3.2.0 (x86_64-pc-linux-gnu-ubuntu-24.04) (496.91 kB)
#>  Got zoo 1.8-14 (x86_64-pc-linux-gnu-ubuntu-24.04) (1.03 MB)
#>  Got ROCR 1.0-11 (x86_64-pc-linux-gnu-ubuntu-24.04) (465.58 kB)
#>  Got future.apply 1.20.0 (x86_64-pc-linux-gnu-ubuntu-24.04) (191.24 kB)
#>  Got tensor 1.5.1 (x86_64-pc-linux-gnu-ubuntu-24.04) (13.96 kB)
#>  Got ica 1.0-3 (x86_64-pc-linux-gnu-ubuntu-24.04) (85.54 kB)
#>  Got SeuratObject 5.2.0 (x86_64-pc-linux-gnu-ubuntu-24.04) (2.08 MB)
#>  Got RcppTOML 0.2.3 (x86_64-pc-linux-gnu-ubuntu-24.04) (244.01 kB)
#>  Got Seurat 5.3.0 (x86_64-pc-linux-gnu-ubuntu-24.04) (2.68 MB)
#>  Got fitdistrplus 1.2-4 (x86_64-pc-linux-gnu-ubuntu-24.04) (2.96 MB)
#>  Got goftest 1.2-3 (x86_64-pc-linux-gnu-ubuntu-24.04) (58.64 kB)
#>  Got listenv 0.9.1 (x86_64-pc-linux-gnu-ubuntu-24.04) (106.26 kB)
#>  Got spam 2.11-1 (x86_64-pc-linux-gnu-ubuntu-24.04) (2.75 MB)
#>  Got parallelly 1.45.1 (x86_64-pc-linux-gnu-ubuntu-24.04) (571.86 kB)
#>  Got leidenbase 0.1.35 (x86_64-pc-linux-gnu-ubuntu-24.04) (1.33 MB)
#>  Got spatstat.geom 3.5-0 (x86_64-pc-linux-gnu-ubuntu-24.04) (4.16 MB)
#>  Got reticulate 1.43.0 (x86_64-pc-linux-gnu-ubuntu-24.04) (1.97 MB)
#>  Got spatstat.sparse 3.1-0 (x86_64-pc-linux-gnu-ubuntu-24.04) (213.31 kB)
#>  Got gtools 3.9.5 (x86_64-pc-linux-gnu-ubuntu-24.04) (361.11 kB)
#>  Got RcppHNSW 0.6.0 (x86_64-pc-linux-gnu-ubuntu-24.04) (217.19 kB)
#>  Got miniUI 0.1.2 (x86_64-pc-linux-gnu-ubuntu-24.04) (35.20 kB)
#>  Got spatstat.utils 3.1-5 (x86_64-pc-linux-gnu-ubuntu-24.04) (398.60 kB)
#>  Got sctransform 0.4.2 (x86_64-pc-linux-gnu-ubuntu-24.04) (565.94 kB)
#>  Got spatstat.univar 3.1-4 (x86_64-pc-linux-gnu-ubuntu-24.04) (324.92 kB)
#>  Got rprojroot 2.1.1 (x86_64-pc-linux-gnu-ubuntu-24.04) (113.23 kB)
#>  Got pbapply 1.7-4 (x86_64-pc-linux-gnu-ubuntu-24.04) (100.53 kB)
#>  Got scattermore 1.2 (x86_64-pc-linux-gnu-ubuntu-24.04) (339.10 kB)
#>  Got sp 2.2-0 (x86_64-pc-linux-gnu-ubuntu-24.04) (5.31 MB)
#>  Got spatstat.random 3.4-1 (x86_64-pc-linux-gnu-ubuntu-24.04) (1.21 MB)
#>  Got spatstat.data 3.1-8 (x86_64-pc-linux-gnu-ubuntu-24.04) (4.17 MB)
#>  Got spatstat.explore 3.5-2 (x86_64-pc-linux-gnu-ubuntu-24.04) (3.50 MB)
#>  Installing system requirements
#>  Executing `sudo sh -c apt-get -y update`
#> Get:1 file:/etc/apt/apt-mirrors.txt Mirrorlist [144 B]
#> Hit:6 https://packages.microsoft.com/repos/azure-cli noble InRelease
#> Hit:7 https://packages.microsoft.com/ubuntu/24.04/prod noble InRelease
#> Hit:2 http://azure.archive.ubuntu.com/ubuntu noble InRelease
#> Hit:3 http://azure.archive.ubuntu.com/ubuntu noble-updates InRelease
#> Hit:4 http://azure.archive.ubuntu.com/ubuntu noble-backports InRelease
#> Hit:5 http://azure.archive.ubuntu.com/ubuntu noble-security InRelease
#> Reading package lists...
#>  Executing `sudo sh -c apt-get -y install python3 libcurl4-openssl-dev libssl-dev make zlib1g-dev libglpk-dev libxml2-dev pandoc libpng-dev libicu-dev`
#> Reading package lists...
#> Building dependency tree...
#> Reading state information...
#> python3 is already the newest version (3.12.3-0ubuntu2).
#> libcurl4-openssl-dev is already the newest version (8.5.0-2ubuntu10.6).
#> libssl-dev is already the newest version (3.0.13-0ubuntu3.5).
#> make is already the newest version (4.3-4.1build2).
#> zlib1g-dev is already the newest version (1:1.3.dfsg-3.1ubuntu2.1).
#> libglpk-dev is already the newest version (5.0-1build2).
#> libxml2-dev is already the newest version (2.9.14+dfsg-1.3ubuntu3.5).
#> pandoc is already the newest version (3.1.3+ds-2).
#> libpng-dev is already the newest version (1.6.43-5build1).
#> libicu-dev is already the newest version (74.2-1ubuntu3.1).
#> 0 upgraded, 0 newly installed, 0 to remove and 41 not upgraded.
#>  Installed caTools 1.18.3  (65ms)
#>  Installed deldir 2.0-4  (110ms)
#>  Installed dotCall64 1.2  (132ms)
#>  Installed fastDummies 1.7.5  (166ms)
#>  Installed fitdistrplus 1.2-4  (72ms)
#>  Installed future 1.67.0  (74ms)
#>  Installed future.apply 1.20.0  (74ms)
#>  Installed globals 0.18.0  (105ms)
#>  Installed goftest 1.2-3  (72ms)
#>  Installed gplots 3.2.0  (75ms)
#>  Installed gtools 3.9.5  (76ms)
#>  Installed here 1.0.2  (76ms)
#>  Installed ica 1.0-3  (69ms)
#>  Installed leidenbase 0.1.35  (100ms)
#>  Installed listenv 0.9.1  (71ms)
#>  Installed lmtest 0.9-40  (71ms)
#>  Installed miniUI 0.1.2  (72ms)
#>  Installed parallelly 1.45.1  (74ms)
#>  Installed pbapply 1.7-4  (74ms)
#>  Installed progressr 0.16.0  (107ms)
#>  Installed RcppHNSW 0.6.0  (105ms)
#>  Installed RcppTOML 0.2.3  (72ms)
#>  Installed reticulate 1.43.0  (76ms)
#>  Installed ROCR 1.0-11  (76ms)
#>  Installed rprojroot 2.1.1  (76ms)
#>  Installed scattermore 1.2  (142ms)
#>  Installed sctransform 0.4.2  (146ms)
#>  Installed Seurat 5.3.0  (80ms)
#>  Installed SeuratObject 5.2.0  (82ms)
#>  Installed sp 2.2-0  (94ms)
#>  Installed spam 2.11-1  (94ms)
#>  Installed spatstat.data 3.1-8  (81ms)
#>  Installed spatstat.explore 3.5-2  (138ms)
#>  Installed spatstat.geom 3.5-0  (90ms)
#>  Installed spatstat.random 3.4-1  (74ms)
#>  Installed spatstat.sparse 3.1-0  (71ms)
#>  Installed spatstat.univar 3.1-4  (70ms)
#>  Installed spatstat.utils 3.1-5  (69ms)
#>  Installed tensor 1.5.1  (67ms)
#>  Installed zoo 1.8-14  (98ms)
#>  1 pkg + 134 deps: kept 94, added 40, dld 38 (40.14 MB) [12.2s]
#>  [2025-09-20 14:02:09] Seurat and reticulate installed successfully