R语言基础配置1

时间:2021-07-28
本文章向大家介绍R语言基础配置1,主要包括R语言基础配置1使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

设置工作目录

临时改变

Session -> Set Working Directory -> Choose Directory

改变默认位置

Tools –> Global options –> General

setwd("D:/sch/RWorkSpace")

这里还可以选择R语言的版本,以后更新后应该只在这里改就ok了。这里默认直接选择和电脑操作系统适配,64位,不是我手动配置的欸。

R包的安装

下了ggplot2的包,控制台的信息:

> installed.packages("ggplot2")
     Package LibPath Version Priority Depends Imports LinkingTo
     Suggests Enhances License License_is_FOSS License_restricts_use
     OS_type Archs MD5sum NeedsCompilation Built
> install.packages("ggplot2")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
还安装相依关系‘colorspace’, ‘cli’, ‘crayon’, ‘utf8’, ‘farver’, ‘labeling’, ‘lifecycle’, ‘munsell’, ‘R6’, ‘RColorBrewer’, ‘viridisLite’, ‘ellipsis’, ‘fansi’, ‘pillar’, ‘pkgconfig’, ‘vctrs’, ‘gtable’, ‘isoband’, ‘scales’, ‘tibble’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/colorspace_2.0-2.zip'
Content type 'application/zip' length 2650069 bytes (2.5 MB)
downloaded 2.5 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/cli_3.0.1.zip'
Content type 'application/zip' length 755424 bytes (737 KB)
downloaded 604 KB

Warning in install.packages :
  downloaded length 618496 != reported length 755424
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/crayon_1.4.1.zip'
Warning in install.packages :
  InternetOpenUrl failed: '操作超时'
Error in download.file(url, destfile, method, mode = "wb", ...) : 
  cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/crayon_1.4.1.zip'
Warning in install.packages :
  download of package ‘crayon’ failed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/utf8_1.2.2.zip'
Content type 'application/zip' length 209802 bytes (204 KB)
downloaded 204 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/farver_2.1.0.zip'
Content type 'application/zip' length 1751988 bytes (1.7 MB)
downloaded 1.7 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/labeling_0.4.2.zip'
Content type 'application/zip' length 62808 bytes (61 KB)
downloaded 61 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/lifecycle_1.0.0.zip'
Content type 'application/zip' length 111130 bytes (108 KB)
downloaded 108 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/munsell_0.5.0.zip'
Content type 'application/zip' length 244348 bytes (238 KB)
downloaded 238 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/R6_2.5.0.zip'
Content type 'application/zip' length 84126 bytes (82 KB)
downloaded 82 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/RColorBrewer_1.1-2.zip'
Content type 'application/zip' length 55593 bytes (54 KB)
downloaded 54 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/viridisLite_0.4.0.zip'
Content type 'application/zip' length 1299472 bytes (1.2 MB)
downloaded 1.2 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/ellipsis_0.3.2.zip'
Content type 'application/zip' length 49144 bytes (47 KB)
downloaded 47 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/fansi_0.5.0.zip'
Content type 'application/zip' length 248766 bytes (242 KB)
downloaded 140 KB

Warning in install.packages :
  downloaded length 143360 != reported length 248766
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/pillar_1.6.1.zip'
Content type 'application/zip' length 1025314 bytes (1001 KB)
downloaded 1001 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/pkgconfig_2.0.3.zip'
Content type 'application/zip' length 22436 bytes (21 KB)
downloaded 21 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/vctrs_0.3.8.zip'
Content type 'application/zip' length 1252896 bytes (1.2 MB)
downloaded 1.2 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/gtable_0.3.0.zip'
Content type 'application/zip' length 434237 bytes (424 KB)
downloaded 424 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/isoband_0.2.5.zip'
Content type 'application/zip' length 2726723 bytes (2.6 MB)

Warning in install.packages :
  downloaded length 999424 != reported length 2726723
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/scales_1.1.1.zip'
Content type 'application/zip' length 562848 bytes (549 KB)
downloaded 549 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/tibble_3.1.3.zip'
Content type 'application/zip' length 835508 bytes (815 KB)
downloaded 784 KB

Warning in install.packages :
  downloaded length 802816 != reported length 835508
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/ggplot2_3.3.5.zip'
Content type 'application/zip' length 4130693 bytes (3.9 MB)
downloaded 1.6 MB

Warning in install.packages :
  downloaded length 1662976 != reported length 4130693
package ‘colorspace’ successfully unpacked and MD5 sums checked
Warning in install.packages :
  error 1 in extracting from zip file
Warning in install.packages :
  cannot open compressed file 'cli/DESCRIPTION', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection

由此看来安装新的包也只是从开源的网站上下载一些zip文件然后解压到library目录中,并未做多余的事,知道这一点之后,我们今后可以手动安装包,手动调整,更新

Rtools

定义

https://cran.rstudio.com/bin/windows/Rtools/

Note that rtools40 is only needed build R packages with C/C++/Fortran code from source. By default, R for Windows installs the precompiled “binary packages” from CRAN, for which you do not need rtools!

To use rtools40, download the installer from CRAN:

Note for RStudio users: please check you are using a recent version of RStudio (at least 1.2.5042) to work with rtools40.


这么看来 x86是64位,i686是32位,对应?

之前下载R语言的时候64位和32位的都下载了。


还需要配置一下环境变量

我们发现rtools_home的系统变量已经自动添加了。

接下来是path,按照官方文档的配置即可。

Putting Rtools on the PATH

After installation is complete, you need to perform one more step to be able to compile R packages: you need to put the location of the Rtools make utilities (bash, make, etc) on the PATH. The easiest way to do so is create a text file .Renviron in your Documents folder which contains the following line:

PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"

You can do this with a text editor, or from R like so (note that in R code you need to escape backslashes):

writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")

Now restart R, and verify that make can be found, which should show the path to your Rtools installation.

Sys.which("make")
## "C:\\rtools40\\usr\\bin\\make.exe"

If this works, you can try to install an R package from source:

install.packages("jsonlite", type = "source")

If this succeeds, you’re good to go! See the links below to learn more about rtools40 and the Windows build infrastructure.

> install.packages("jsonlite", type = "source")
trying URL 'https://cran.rstudio.com/src/contrib/jsonlite_1.7.2.tar.gz'
Content type 'application/x-gzip' length 421716 bytes (411 KB)
downloaded 411 KB

* installing *source* package 'jsonlite' ...
** package 'jsonlite' successfully unpacked and MD5 sums checked
** using staged installation
** libs

*** arch - i386
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c base64.c -o base64.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c collapse_array.c -o collapse_array.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c collapse_object.c -o collapse_object.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c collapse_pretty.c -o collapse_pretty.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c escape_chars.c -o escape_chars.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c integer64_to_na.c -o integer64_to_na.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c is_datelist.c -o is_datelist.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c is_recordlist.c -o is_recordlist.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c is_scalarlist.c -o is_scalarlist.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c modp_numtoa.c -o modp_numtoa.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c null_to_na.c -o null_to_na.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c num_to_char.c -o num_to_char.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c parse.c -o parse.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c prettify.c -o prettify.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c push_parser.c -o push_parser.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c r-base64.c -o r-base64.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c register.c -o register.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c row_collapse.c -o row_collapse.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c transpose_list.c -o transpose_list.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c validate.c -o validate.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl.c -o yajl/yajl.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl_alloc.c -o yajl/yajl_alloc.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl_buf.c -o yajl/yajl_buf.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl_encode.c -o yajl/yajl_encode.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl_gen.c -o yajl/yajl_gen.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl_lex.c -o yajl/yajl_lex.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl_parser.c -o yajl/yajl_parser.o
/mingw32/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl_tree.c -o yajl/yajl_tree.o
/mingw32/bin/ar rcs yajl/libstatyajl.a yajl/yajl.o yajl/yajl_alloc.o yajl/yajl_buf.o yajl/yajl_encode.o yajl/yajl_gen.o yajl/yajl_lex.o yajl/yajl_parser.o yajl/yajl_tree.o
/mingw32/bin/gcc -shared -s -static-libgcc -o jsonlite.dll tmp.def base64.o collapse_array.o collapse_object.o collapse_pretty.o escape_chars.o integer64_to_na.o is_datelist.o is_recordlist.o is_scalarlist.o modp_numtoa.o null_to_na.o num_to_char.o parse.o prettify.o push_parser.o r-base64.o register.o row_collapse.o transpose_list.o validate.o -Lyajl -lstatyajl -LE:/software/R/R-4.1.0/bin/i386 -lR
installing to E:/software/R/R-4.1.0/library/00LOCK-jsonlite/00new/jsonlite/libs/i386

*** arch - x64
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c base64.c -o base64.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c collapse_array.c -o collapse_array.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c collapse_object.c -o collapse_object.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c collapse_pretty.c -o collapse_pretty.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c escape_chars.c -o escape_chars.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c integer64_to_na.c -o integer64_to_na.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c is_datelist.c -o is_datelist.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c is_recordlist.c -o is_recordlist.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c is_scalarlist.c -o is_scalarlist.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c modp_numtoa.c -o modp_numtoa.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c null_to_na.c -o null_to_na.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c num_to_char.c -o num_to_char.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c parse.c -o parse.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c prettify.c -o prettify.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c push_parser.c -o push_parser.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c r-base64.c -o r-base64.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c register.c -o register.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c row_collapse.c -o row_collapse.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c transpose_list.c -o transpose_list.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c validate.c -o validate.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl.c -o yajl/yajl.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl_alloc.c -o yajl/yajl_alloc.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl_buf.c -o yajl/yajl_buf.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl_encode.c -o yajl/yajl_encode.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl_gen.c -o yajl/yajl_gen.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl_lex.c -o yajl/yajl_lex.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl_parser.c -o yajl/yajl_parser.o
/mingw64/bin/gcc  -I"E:/software/R/R-4.1.0/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c yajl/yajl_tree.c -o yajl/yajl_tree.o
/mingw64/bin/ar rcs yajl/libstatyajl.a yajl/yajl.o yajl/yajl_alloc.o yajl/yajl_buf.o yajl/yajl_encode.o yajl/yajl_gen.o yajl/yajl_lex.o yajl/yajl_parser.o yajl/yajl_tree.o
/mingw64/bin/gcc -shared -s -static-libgcc -o jsonlite.dll tmp.def base64.o collapse_array.o collapse_object.o collapse_pretty.o escape_chars.o integer64_to_na.o is_datelist.o is_recordlist.o is_scalarlist.o modp_numtoa.o null_to_na.o num_to_char.o parse.o prettify.o push_parser.o r-base64.o register.o row_collapse.o transpose_list.o validate.o -Lyajl -lstatyajl -LE:/software/R/R-4.1.0/bin/x64 -lR
installing to E:/software/R/R-4.1.0/library/00LOCK-jsonlite/00new/jsonlite/libs/x64
** R
** inst
** byte-compile and prepare package for lazy loading
in method for 'asJSON' with signature '"blob"': 类别"blob"的定义不存在
** help
*** installing help indices
  converting help for package 'jsonlite'
    finding HTML links ... done
    base64                                  html  
    flatten                                 html  
    fromJSON                                html  
    prettify                                html  
    rbind_pages                             html  
    read_json                               html  
    serializeJSON                           html  
    stream_in                               html  
    unbox                                   html  
    validate                                html  
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
** testing if installed package can be loaded from final location
*** arch - i386
*** arch - x64
** testing if installed package keeps a record of temporary installation path
* DONE (jsonlite)
Making 'packages.html' ... done

The downloaded source packages are in
	‘C:\Users\ChangHao\AppData\Local\Temp\Rtmp6p9J0w\downloaded_packages’

我们看到jsonlite包已经躺在了我们期待的目录下,表明上述操作成功。

最后一行显示

The downloaded source packages are in
	‘C:\Users\ChangHao\AppData\Local\Temp\Rtmp6p9J0w\downloaded_packages’

似乎把一些东西存入了C盘?没有关系,这是temp文件,appdata,而且不是很大,其实就是jsonlite_1.7.2.tar.gz,大小412K.

再装一次ggplot2

> install.packages("ggplot2")
还安装相依关系‘cli’, ‘crayon’, ‘utf8’, ‘farver’, ‘labeling’, ‘lifecycle’, ‘munsell’, ‘R6’, ‘RColorBrewer’, ‘viridisLite’, ‘ellipsis’, ‘fansi’, ‘pillar’, ‘pkgconfig’, ‘vctrs’, ‘gtable’, ‘isoband’, ‘scales’, ‘tibble’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/cli_3.0.1.zip'
Content type 'application/zip' length 755424 bytes (737 KB)
downloaded 737 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/crayon_1.4.1.zip'
Content type 'application/zip' length 141777 bytes (138 KB)
downloaded 138 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/utf8_1.2.2.zip'
Content type 'application/zip' length 209802 bytes (204 KB)
downloaded 204 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/farver_2.1.0.zip'
Content type 'application/zip' length 1751988 bytes (1.7 MB)
downloaded 1.7 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/labeling_0.4.2.zip'
Content type 'application/zip' length 62808 bytes (61 KB)
downloaded 61 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/lifecycle_1.0.0.zip'
Content type 'application/zip' length 111130 bytes (108 KB)
downloaded 108 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/munsell_0.5.0.zip'
Content type 'application/zip' length 244348 bytes (238 KB)
downloaded 238 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/R6_2.5.0.zip'
Content type 'application/zip' length 84126 bytes (82 KB)
downloaded 82 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/RColorBrewer_1.1-2.zip'
Content type 'application/zip' length 55593 bytes (54 KB)
downloaded 54 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/viridisLite_0.4.0.zip'
Content type 'application/zip' length 1299472 bytes (1.2 MB)
downloaded 1.2 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/ellipsis_0.3.2.zip'
Content type 'application/zip' length 49144 bytes (47 KB)
downloaded 47 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/fansi_0.5.0.zip'
Content type 'application/zip' length 248766 bytes (242 KB)
downloaded 242 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/pillar_1.6.1.zip'
Content type 'application/zip' length 1025314 bytes (1001 KB)
downloaded 1001 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/pkgconfig_2.0.3.zip'
Content type 'application/zip' length 22436 bytes (21 KB)
downloaded 21 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/vctrs_0.3.8.zip'
Content type 'application/zip' length 1252896 bytes (1.2 MB)
downloaded 1.2 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/gtable_0.3.0.zip'
Content type 'application/zip' length 434237 bytes (424 KB)
downloaded 424 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/isoband_0.2.5.zip'
Content type 'application/zip' length 2726723 bytes (2.6 MB)
downloaded 2.6 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/scales_1.1.1.zip'
Content type 'application/zip' length 562848 bytes (549 KB)
downloaded 549 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/tibble_3.1.3.zip'
Content type 'application/zip' length 835508 bytes (815 KB)
downloaded 815 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/ggplot2_3.3.5.zip'
Content type 'application/zip' length 4130693 bytes (3.9 MB)
downloaded 3.9 MB

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 ‘pillar’ successfully unpacked and MD5 sums checked
package ‘pkgconfig’ successfully unpacked and MD5 sums checked
package ‘vctrs’ successfully unpacked and MD5 sums checked
package ‘gtable’ successfully unpacked and MD5 sums checked
package ‘isoband’ successfully unpacked and MD5 sums checked
package ‘scales’ successfully unpacked and MD5 sums checked
package ‘tibble’ successfully unpacked and MD5 sums checked
package ‘ggplot2’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\ChangHao\AppData\Local\Temp\Rtmp6p9J0w\downloaded_packages

瞬间完成,我记得当时有一些warning,最后还有一个error,connection无法打开,看来并没有产生实质性影响?也许也是rtools的功劳?不太清楚...

原文地址:https://www.cnblogs.com/sch14159/p/15072077.html