升级后我开始收到此错误。有趣的是,当我在R Terminal中运行代码时,我没有遇到任何错误。以“R CMD test.R”运行批处理命令会收到错误。
Error in `colnames<-`(`*tmp*`, value = c("L0", "Date", "Close", "Change", :
'names' attribute [5] must be the same length as the vector [0]
R代码是这样的:
require(RPostgreSQL);
drv_generic <- dbDriver("PostgreSQL")
dbcon <- dbConnect( drv=drv_generic, "192.168.15.120", port=8085, user="test",password="yyyyyy", dbname="testdb" )
qs <- sprintf("select * from some_function_name('%s', '%s', %d,
'id, tdate, cl, chg, factor')
as (L0 integer, \"Date\" date, \"Close\" double precision, \"Change\" double precision,
\"Factor\" double precision)",
as.character(fromdate,format="%Y-%m-%d"),
as.character(todate,format="%Y-%m-%d"),
id );
r = dbGetQuery( dbcon, qs,stringsAsFactors=F );
colnames(r) <- c("L0","Date","Close","Change", "Adj");