1. 程式人生 > 其它 >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的功勞?不太清楚...