R语言安装软件包

R语言安装软件包

  • 1 打开RGui.exe,执行```install.packages("software name")```,安装成功后会提示```The downloaded binary packages are in ...```,给出了程序包存放路径
  • 2 选择程序包,点击```Install package(s) from local files...```,选中路径里面下载好的程序包,会出现```successfully unpacked```的提示
  • 3 命令及执行结果示例

1 打开RGui.exe,执行install.packages("software name"),安装成功后会提示The downloaded binary packages are in ...,给出了程序包存放路径

R语言安装软件包_第1张图片

2 选择程序包,点击Install package(s) from local files...,选中路径里面下载好的程序包,会出现successfully unpacked的提示

> utils:::menuInstallLocal()
package ‘psych’ successfully unpacked and MD5 sums checked

R语言安装软件包_第2张图片
R语言安装软件包_第3张图片

3 命令及执行结果示例

R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

R是自由软件,不带任何担保。
在某些条件下你可以将其自由散布。
用'license()'或'licence()'来看散布的详细条件。

R是个合作计划,有许多人为之做出了贡献.
用'contributors()'来看合作者的详细情况
用'citation()'会告诉你如何在出版物中正确地引用R或R程序包。

用'demo()'来看一些示范程序,用'help()'来阅读在线帮助文件,或
用'help.start()'通过HTML浏览器来看帮助文件。
用'q()'退出R.

> install.package("psych")
Error in install.package("psych") : 没有"install.package"这个函数
> install.packages("psych")
--- 在此連線階段时请选用CRAN的鏡子 ---
还安装相依关系‘tmvnsim’, ‘mnormt’

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/tmvnsim_1.0-2.zip'
Content type 'application/zip' length 37073 bytes (36 KB)
downloaded 36 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/mnormt_2.0.2.zip'
Content type 'application/zip' length 193615 bytes (189 KB)
downloaded 189 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/psych_2.1.9.zip'
Content type 'application/zip' length 4245236 bytes (4.0 MB)
downloaded 4.0 MB

package ‘tmvnsim’ successfully unpacked and MD5 sums checked
package ‘mnormt’ successfully unpacked and MD5 sums checked
package ‘psych’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
        C:\Users\99\AppData\Local\Temp\RtmpEDx6Cz\downloaded_packages
> local({pkg <- select.list(sort(.packages(all.available = TRUE)),graphics=TRUE)
+ if(nchar(pkg)) library(pkg, character.only=TRUE)})
> setRepositories()
> utils:::menuInstallLocal()
package ‘psych’ successfully unpacked and MD5 sums checked
> install.packages("ggplot2")
还安装相依关系‘colorspace’, ‘cli’, ‘crayon’, ‘utf8’, ‘farver’, ‘labeling’, ‘lifecycle’, ‘munsell’, ‘R6’, ‘RColorBrewer’, ‘viridisLite’, ‘ellipsis’, ‘fansi’, ‘magrittr’, ‘pillar’, ‘pkgconfig’, ‘vctrs’, ‘digest’, ‘glue’, ‘gtable’, ‘isoband’, ‘rlang’, ‘scales’, ‘tibble’, ‘withr’


  有二进制版本的,但源代码版本是后来的:
      binary source needs_compilation
fansi  0.5.0  1.0.0              TRUE

  Binaries will be installed
试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/colorspace_2.0-2.zip'
Content type 'application/zip' length 2645168 bytes (2.5 MB)
downloaded 2.5 MB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/cli_3.1.0.zip'
Content type 'application/zip' length 1235892 bytes (1.2 MB)
downloaded 1.2 MB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/crayon_1.4.2.zip'
Content type 'application/zip' length 157657 bytes (153 KB)
downloaded 153 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/utf8_1.2.2.zip'
Content type 'application/zip' length 209987 bytes (205 KB)
downloaded 205 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/farver_2.1.0.zip'
Content type 'application/zip' length 1752511 bytes (1.7 MB)
downloaded 1.7 MB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/labeling_0.4.2.zip'
Content type 'application/zip' length 62679 bytes (61 KB)
downloaded 61 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/lifecycle_1.0.1.zip'
Content type 'application/zip' length 123104 bytes (120 KB)
downloaded 120 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/munsell_0.5.0.zip'
Content type 'application/zip' length 245327 bytes (239 KB)
downloaded 239 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/R6_2.5.1.zip'
Content type 'application/zip' length 84245 bytes (82 KB)
downloaded 82 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/RColorBrewer_1.1-2.zip'
Content type 'application/zip' length 55707 bytes (54 KB)
downloaded 54 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/viridisLite_0.4.0.zip'
Content type 'application/zip' length 1299512 bytes (1.2 MB)
downloaded 1.2 MB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/ellipsis_0.3.2.zip'
Content type 'application/zip' length 49237 bytes (48 KB)
downloaded 48 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/fansi_0.5.0.zip'
Content type 'application/zip' length 248821 bytes (242 KB)
downloaded 242 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/magrittr_2.0.1.zip'
Content type 'application/zip' length 235806 bytes (230 KB)
downloaded 230 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/pillar_1.6.4.zip'
Content type 'application/zip' length 1041521 bytes (1017 KB)
downloaded 1017 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/pkgconfig_2.0.3.zip'
Content type 'application/zip' length 22480 bytes (21 KB)
downloaded 21 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/vctrs_0.3.8.zip'
Content type 'application/zip' length 1254380 bytes (1.2 MB)
downloaded 1.2 MB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/digest_0.6.29.zip'
Content type 'application/zip' length 266579 bytes (260 KB)
downloaded 260 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/glue_1.6.0.zip'
Content type 'application/zip' length 173672 bytes (169 KB)
downloaded 169 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/gtable_0.3.0.zip'
Content type 'application/zip' length 434194 bytes (424 KB)
downloaded 424 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/isoband_0.2.5.zip'
Content type 'application/zip' length 2726788 bytes (2.6 MB)
downloaded 2.6 MB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/rlang_0.4.12.zip'
Content type 'application/zip' length 1200810 bytes (1.1 MB)
downloaded 1.1 MB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/scales_1.1.1.zip'
Content type 'application/zip' length 558614 bytes (545 KB)
downloaded 545 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/tibble_3.1.6.zip'
Content type 'application/zip' length 872274 bytes (851 KB)
downloaded 851 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/withr_2.4.3.zip'
Content type 'application/zip' length 217158 bytes (212 KB)
downloaded 212 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/ggplot2_3.3.5.zip'
Content type 'application/zip' length 4130171 bytes (3.9 MB)
downloaded 3.9 MB

package ‘colorspace’ successfully unpacked and MD5 sums checked
package ‘cli’ successfully unpacked and MD5 sums checked
package ‘crayon’ successfully unpacked and MD5 sums checked
package ‘utf8’ successfully unpacked and MD5 sums checked
package ‘farver’ successfully unpacked and MD5 sums checked
package ‘labeling’ successfully unpacked and MD5 sums checked
package ‘lifecycle’ successfully unpacked and MD5 sums checked
package ‘munsell’ successfully unpacked and MD5 sums checked
package ‘R6’ successfully unpacked and MD5 sums checked
package ‘RColorBrewer’ successfully unpacked and MD5 sums checked
package ‘viridisLite’ successfully unpacked and MD5 sums checked
package ‘ellipsis’ successfully unpacked and MD5 sums checked
package ‘fansi’ successfully unpacked and MD5 sums checked
package ‘magrittr’ successfully unpacked and MD5 sums checked
package ‘pillar’ successfully unpacked and MD5 sums checked
package ‘pkgconfig’ successfully unpacked and MD5 sums checked
package ‘vctrs’ successfully unpacked and MD5 sums checked
package ‘digest’ successfully unpacked and MD5 sums checked
package ‘glue’ successfully unpacked and MD5 sums checked
package ‘gtable’ successfully unpacked and MD5 sums checked
package ‘isoband’ successfully unpacked and MD5 sums checked
package ‘rlang’ successfully unpacked and MD5 sums checked
package ‘scales’ successfully unpacked and MD5 sums checked
package ‘tibble’ successfully unpacked and MD5 sums checked
package ‘withr’ successfully unpacked and MD5 sums checked
package ‘ggplot2’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
        C:\Users\99\AppData\Local\Temp\RtmpEDx6Cz\downloaded_packages
> utils:::menuInstallPkgs()
> setRepositories()
> local({pkg <- select.list(sort(.packages(all.available = TRUE)),graphics=TRUE)
+ if(nchar(pkg)) library(pkg, character.only=TRUE)})
> utils:::menuInstallLocal()
package ‘ggplot2’ successfully unpacked and MD5 sums checked
> install.packages("reshape2")
还安装相依关系‘stringi’, ‘plyr’, ‘Rcpp’, ‘stringr’

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/stringi_1.7.6.zip'
Content type 'application/zip' length 16449819 bytes (15.7 MB)
downloaded 15.7 MB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/plyr_1.8.6.zip'
Content type 'application/zip' length 1499468 bytes (1.4 MB)
downloaded 1.4 MB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/Rcpp_1.0.7.zip'
Content type 'application/zip' length 3263155 bytes (3.1 MB)
downloaded 3.1 MB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/stringr_1.4.0.zip'
Content type 'application/zip' length 216753 bytes (211 KB)
downloaded 211 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/reshape2_1.4.4.zip'
Content type 'application/zip' length 818001 bytes (798 KB)
downloaded 798 KB

package ‘stringi’ successfully unpacked and MD5 sums checked
package ‘plyr’ successfully unpacked and MD5 sums checked
package ‘Rcpp’ successfully unpacked and MD5 sums checked
package ‘stringr’ successfully unpacked and MD5 sums checked
package ‘reshape2’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
        C:\Users\99\AppData\Local\Temp\RtmpEDx6Cz\downloaded_packages
> utils:::menuInstallLocal()
package ‘reshape2’ successfully unpacked and MD5 sums checked
> install.packages("relaimpo")
还安装相依关系‘minqa’, ‘numDeriv’, ‘DBI’, ‘survey’, ‘mitools’, ‘corpcor’

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/minqa_1.2.4.zip'
Content type 'application/zip' length 855876 bytes (835 KB)
downloaded 835 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/numDeriv_2016.8-1.1.zip'
Content type 'application/zip' length 116205 bytes (113 KB)
downloaded 113 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/DBI_1.1.2.zip'
Content type 'application/zip' length 741793 bytes (724 KB)
downloaded 724 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/survey_4.1-1.zip'
Content type 'application/zip' length 2728411 bytes (2.6 MB)
downloaded 2.6 MB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/mitools_2.4.zip'
Content type 'application/zip' length 298648 bytes (291 KB)
downloaded 291 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/corpcor_1.6.10.zip'
Content type 'application/zip' length 115070 bytes (112 KB)
downloaded 112 KB

试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/relaimpo_2.2-6.zip'
Content type 'application/zip' length 562932 bytes (549 KB)
downloaded 549 KB

package ‘minqa’ successfully unpacked and MD5 sums checked
package ‘numDeriv’ successfully unpacked and MD5 sums checked
package ‘DBI’ successfully unpacked and MD5 sums checked
package ‘survey’ successfully unpacked and MD5 sums checked
package ‘mitools’ successfully unpacked and MD5 sums checked
package ‘corpcor’ successfully unpacked and MD5 sums checked
package ‘relaimpo’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
        C:\Users\99\AppData\Local\Temp\RtmpEDx6Cz\downloaded_packages
> install.packages("MASS")
试开URL’https://cloud.r-project.org/bin/windows/contrib/4.1/MASS_7.3-54.zip'
Content type 'application/zip' length 1191296 bytes (1.1 MB)
downloaded 1.1 MB

package ‘MASS’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package ‘MASS’
Warning: restored ‘MASS’

The downloaded binary packages are in
        C:\Users\99\AppData\Local\Temp\RtmpEDx6Cz\downloaded_packages
Warning message:
In file.copy(savedcopy, lib, recursive = TRUE) :
  拷贝D:\R\R-4.1.2\library\00LOCK\MASS\libs\x64\MASS.dll到D:\R\R-4.1.2\library\MASS\libs\x64\MASS.dll时出了问题:Permission denied 
> utils:::menuInstallLocal()
package ‘relaimpo’ successfully unpacked and MD5 sums checked
> remove.packages(c("relaimpo"))
从‘D:/R/R-4.1.2/library’中删除程序包
(因为没有指定‘lib’)
> remove.packages(c("relaimpo"),lib = file .path("path", "to", "library"))
错误: unexpected symbol在"remove.packages(c("relaimpo"),lib = file .path"里
> remove.packages(c("relaimpo"),lib = file.path("path", "to", "library"))
Error in find.package(pkgs, lib) : 不存在叫‘relaimpo’这个名字的程辑包
> remove.packages(c("relaimpo"),lib=file.path("path", "to", "library"))
Error in find.package(pkgs, lib) : 不存在叫‘relaimpo’这个名字的程辑包
> utils:::menuInstallLocal()
package ‘relaimpo’ successfully unpacked and MD5 sums checked
> install.packages("packfor")
Warning message:
package ‘packfor’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages 
> utils:::menuInstallLocal()
package ‘R.matlab’ successfully unpacked and MD5 sums checked
> 

你可能感兴趣的:(R,r语言,开发语言)