0

考虑下面的场景。在 R2.14.0 中添加包“RMySQL”

> install.packages('RMySQL',type='source')


* installing *source* package 'RMySQL' ...
** package 'RMySQL' successfully unpacked and MD5 sums checked
**checking for $MYSQL_HOME... C:/wampp/mysql/**

gcc  -I"G:/PROGRA~1/R/R-214~1.0/include" -I"C:/wampp/mysql/"/include    -I"d:/RCompile/CRANpkg/extralibs/local/include"     -O3 -Wall  -std=gnu99 -mtune=core2 -c RS-DBI.c -o RS-DBI.o
gcc  -I"G:/PROGRA~1/R/R-214~1.0/include" -I"C:/wampp/mysql/"/include    -I"d:/RCompile/CRANpkg/extralibs/local/include"     -O3 -Wall  -std=gnu99 -mtune=core2 -c RS-MySQL.c -o RS-MySQL.o
gcc -shared -s -static-libgcc -o RMySQL.dll tmp.def RS-DBI.o RS-MySQL.o -Ld:/RCompile/CRANpkg/extralibs/local/lib C:/wampp/mysql//lib/opt/libmysql.lib -LG:/PROGRA~1/R/R-214~1.0/bin/i386 -lR
installing to G:/Program Files/R/R-2.14.0/library/RMySQL/libs/i386
** R
** inst
** preparing package for lazy loading
Creating a generic function for 'format' from package 'base' in package 'RMySQL'
Creating a generic function for 'print' from package 'base' in package 'RMySQL'
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
Error : .onLoad failed in loadNamespace() for 'RMySQL', details:
  call: i$Location
  error: $ operator is invalid for atomic vectors
Error: loading failed
Execution halted
ERROR: loading failed
* removing 'G:/Program Files/R/R-2.14.0/library/RMySQL'

安装失败的任何想法或解释?平台详情:

  1. 赢XP
  2. R2.14.0
  3. RMySQL_0.9-3.tar.gz
  4. MySQL 来自最新的 xampp 安装,其中 lib 和头文件位于 mysql_home 目录下的各个目录中。
4

1 回答 1

1

最新版本 MySQL 的注册表的性质与包中的代码不匹配。

在 tar.gz 文件中,有一个 R 文件“\RMySQL_0.9-3.tar\RMySQL\R\zzz.R”,其中包含以下代码:

# check registry
if (!dir.exists(mysql)) {
    reg <- utils::readRegistry("SOFTWARE\\MySQL AB", hive="HLM", maxdepth=2)
    for (i in reg){
    mysql <- i$Location
    if (dir.exists(mysql)) {
        if (verbose) cat(mysql, "found in registry\n")
        break
    }
    }
}

以前“reg”的每个元素都是一个列表,但现在第一个元素是一个向量。这意味着“mysql <- i$Location”语句将失败,创建您观察到的错误消息。

我修改了语句以通过更改行来跳过注册表的第一个元素

for (i in reg){

for (i in reg[-1]){

并通过在本地修改的 tarball 上运行 install.packages 来安装。

于 2013-10-22T20:17:06.930 回答