[英]making change to function in R package and installing on Ubuntu
Short question: I want to edit the postgresqlWriteTable
function in the RPostgreSQL
package and install it on R running on an Ubuntu machine. 简短的问题:我想编辑
RPostgreSQL
包中的postgresqlWriteTable
函数并将其安装在运行Ubuntu机器的R上。
Long explanation: 详细说明:
The root of my problem is that I am trying to write to a postgres table with an auto-incrementing primary key column from R using dbWriteTable
from RPostgreSQL
package. 我的问题的根源在于,我试图使用
RPostgreSQL
包中的dbWriteTable
,使用R中的自动递增主键列写入postgres表。
I read this post: How do I write data from R to PostgreSQL tables with an autoincrementing primary key? 我读了这篇文章: 如何使用自动递增的主键将数据从R写入PostgreSQL表? which suggested a fix to my problem by changing the function
postgresqlWriteTable
in the RPostgreSQL
package. 它通过更改
RPostgreSQL
软件包中的函数postgresqlWriteTable
提出了解决我的问题的建议。 It works when I interactively use fixInNamespace
in OSX environment and edit the function. 当我在OSX环境中以交互方式使用
fixInNamespace
并编辑该功能时,它将起作用。
Unfortunately I have to run my script on an AWS instance running R on Ubuntu. 不幸的是,我必须在Ubuntu上运行R的AWS实例上运行脚本。 I have
RPostgreSQL
installed at this location on my machine: /usr/local/lib/R/site-library/RPostgreSQL
. 我在
RPostgreSQL
上的以下位置安装了RPostgreSQL
: /usr/local/lib/R/site-library/RPostgreSQL
。 I installed it by invoking R CMD install RPostgreSQL_0.4-1.tar.gz
我通过调用
R CMD install RPostgreSQL_0.4-1.tar.gz
安装了它
Now I am trying to find the function postgresqlWriteTable
. 现在,我试图找到函数
postgresqlWriteTable
。 It is supposed to be in the file PostgreSQLSupport.R
. 它应该在文件
PostgreSQLSupport.R
。 I have searched the whole library - there is no such file. 我已经搜索了整个库-没有这样的文件。
I realized that on my local machine in the OSX Finder , when I unzip the tar.gz package folder, I can see the file PostgreSQLSupport.R
where I am supposed to change the function. 我意识到在OSX Finder的本地计算机上,当我解压缩tar.gz软件包文件夹时,可以看到文件
PostgreSQLSupport.R
,我应该在其中更改功能。
So I changed the function. 所以我改变了功能。 Then I removed the installed RPostgreSQL from my Ubuntu machine and copied the new folder (from my local machine) into my Ubuntu machine and tried to use
devtools
to install the package as suggested in the post here: Loading an R Package from a Custom directory 然后,我从Ubuntu机器中删除了已安装的RPostgreSQL,并将新文件夹(从本地机器)复制到Ubuntu机器中,并尝试使用
devtools
来安装软件包,如本文中的建议: 从自定义目录加载R软件包
here's what happened: 这是发生了什么:
> 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)
I am at my wit's end ! 我没办法 !
.tar.gz
file to the AWS machine. .tar.gz
文件复制到AWS机器上。 DESCRIPTION
file. DESCRIPTION
文件中的版本号。 devtools::build
to create a new .tar.gz
file. devtools::build
创建一个新的.tar.gz
文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.