如何在 Windows 10 上的 R 中安装包 stringi?

How to install package stringi in R on Windows 10?

我刚刚安装了 R 和 RStudio,所以它是最新版本。 我正在尝试安装 Rattle 但出现 stringi 错误,因此我尝试安装 stringi 但出现以下错误:

Installing package into ‘C:/Users/.../Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
* installing *source* package 'stringi' ...
** package 'stringi' successfully unpacked and MD5 sums checked
** libs

*** arch - i386
c:/Rtools/mingw_32/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-35~1.1/include" -DNDEBUG -I. -Iicu61/ -Iicu61/unicode -Iicu61/common -Iicu61/i18n -DU_STATIC_IMPLEMENTATION -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL -DU_TOOLUTIL_IMPLEMENTATION -DNDEBUG -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 -DU_USE_STRTOD_L=0         -O2 -Wall  -mtune=generic -c stri_pad.cpp -o stri_pad.o
/bin/sh: c:/Rtools/mingw_32/bin/g++: No such file or directory
make: *** [C:/PROGRA~1/R/R-35~1.1/etc/i386/Makeconf:215: stri_pad.o] Error 127
ERROR: compilation failed for package 'stringi'
* removing 'C:/Users/maryamr/Documents/R/win-library/3.5/stringi'
In R CMD INSTALL
Warning in install.packages :
  installation of package ‘C:/Users/maryamr/Downloads/stringi_1.2.4.tar.gz’ had non-zero exit status

您需要 Rtools if you want to build R packages from source on Windows. This might be difficult in this case, since stringi 当前在 Windows 上失败。您可以通过

安装最新可用的 windows 二进制文件
install.packages("stringi", type = "win.binary")