简单的问题:我想编辑RPostgreSQL
包中的postgresqlWriteTable
函数,并将其安装在运行在Ubuntu机器上的R上。
长解释:
我的问题的根源是,我正尝试使用RPostgreSQL
包中的dbWriteTable
从R中的自动递增主键列写入postgres表。
我读了这篇文章: 如何用自动增量主键将数据从R写入PostgreSQL表? 它通过改变RPostgreSQL
包中的函数postgresqlWriteTable
来解决我的问题。 当我在OSX环境中交互式地使用fixInNamespace
并且编辑函数时,它是有效的。
不幸的是,我必须在Ubuntu上运行R的AWS实例上运行我的脚本。 我在我的机器上的这个位置安装了RPostgreSQL
: /usr/local/lib/R/site-library/RPostgreSQL
。 我通过调用R CMD install RPostgreSQL_0.4-1.tar.gz
安装它
现在我试图find函数postgresqlWriteTable
。 它应该在文件PostgreSQLSupport.R
。 我搜查了整个图书馆 – 没有这样的文件。
我意识到在OSX Finder的本地机器上,当我解压缩tar.gz包文件夹时,我可以看到PostgreSQLSupport.R
文件,我应该改变这个function。
所以我改变了function。 然后,我从我的Ubuntu机器上移除已安装的RPostgreSQL,并将新文件夹(从本地机器)复制到我的Ubuntu机器上,并尝试使用devtools
来安装软件包,如后文所述: 从自定义目录加载R软件包
这是发生了什么事情:
> library("devtools") > install("/usr/local/lib/R/site-library/RPostgreSQL") Error: Can't find '/usr/local/lib/R/site-library/RPostgreSQL'. > install("RPostgreSQL", "/usr/local/lib/R/site-library/RPostgreSQL") Installing RPostgreSQL '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet \ CMD INSTALL '/datasci/nikhil/RPostgreSQL' \ --library='/usr/local/lib/R/site-library' --install-tests * installing *source* package 'RPostgreSQL' ... file 'R/PostgreSQLSupport.R' has the wrong MD5 checksum ERROR: 'configure' exists but is not executable -- see the 'R Installation and Administration Manual' * removing '/usr/local/lib/R/site-library/RPostgreSQL' Error: Command failed (1)
我不知道该怎么做 !
.tar.gz
文件复制到AWS机器。 DESCRIPTION
文件中的版本号。 devtools::build
创建一个新的.tar.gz
文件。