安装了ORE, 连接Oracle数据库, NEW_FLat1 是该数据库的一个表
> d1 <- ore.get("NEW_FLat1")
想要把d1的后13列改成字符格式,做了如下尝试:
> d1[, 2:14]<- by(d1[, 2:14], as.ore.character)
Error  in function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,  :
  cannot coerce class 'Standard Generic' into an 'ore.frame'
> d1[, 2:14]<- by(d1[, 2:14], as.character)
Error  in function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,  :
  cannot coerce class 'function' into an 'ore.frame'
> d1[, 2:14] <- as.ore.character(d1[, 2:14])
Error  in '[<-.data.frame'('*tmp*', , i, value =character(0))  :
  new columns would leave holes after existing columns
In addition: Warning message:
In '[<-.data.frame'('*tmp*', , i, value =character(0))  :
  Setting class(x) to NULL; result will no longer be an S4 object
> d1[, 2:14] <- as.character(d1[, 2:14])
Error  in '[<-.data.frame'('*tmp*', , i, value =character(0))  :
  new columns would leave holes after existing columns
In addition: Warning message:
In '[<-.data.frame'('*tmp*', , i, value =character(0))  :
  Setting class(x) to NULL;  result will no longer be an S4 object
> d1[, 2] <- as.character(d1[, 2])
Error  in '[<-.data.frame'('*tmp*', , 2, value =character(0))  :
  new columns would leave holes after existing columns
In addition: Warning message:
In '[<-.data.frame'('*tmp*', , 2, value =character(0))  :
  Setting class(x) to NULL;  result will no longer be an S4 object
然后查看了d1,
> dim(d1)
 [1]  2227868             14
> str(d1[,2])
Formal class 'ore.factor' [package "OREbase"] with 8你slots
  ..@ .Data      :  raw(0)
  ..@ dataQry  : Named chr [1:2] "( select \ "RowID\" NAME001, \ "RowID\" VAL001, \ "NAME\" VAL002, ......
  .. .. - attr(*, "names") = chr [1:2]  "803_227" "803_286"
  ..@ dataObj  : chr  "803_286"
  ..@ sqlName  : chr "\"RowID\""
  ..@ sqlValue  : chr "\"NAME\""
  ..@ sqlTable  : chr "\"XXX\".\ "NEW_FLAT1\""
  ..@ sqlPred   : chr ""
  ..@ exRef     : list()
以前曾经用ore.pull(),然后再用R. 可现在的表太大,  取出来太慢, 想直接用ORE,希望高手指点一下...
拜谢