【发布时间】:2017-06-16 08:53:01
【问题描述】:
R 数据框中的一列中有“,”(逗号),因此,当我尝试将其转换为 netezza 数据框时,它会抛出以下错误:
nzQuery(sqlCommandUpload) 中的错误:HY008 51 操作已取消 01000 1 无法写入 nzlog/坏文件 01000 1 无法写入 nzlog/坏文件 HY000 46 错误:外部表:错误输入行数达到最大错误限制
如何在不更改数据的情况下实现这一目标?
library(nzr)
library(forecast)
library (reshape2)
library(doBy)
nzDisconnect()
nzConnectDSN('DSNInfo', force=FALSE , verbose=TRUE)
#read file
test2<-read.csv("test_df.csv", stringsAsFactors = F)
# convert to nz dataframe, no error
#nzdf.test2<-as.nz.data.frame(test2)
nzdf.d<-as.nz.data.frame(d)
# copy
#test<-test2
testd<-d
#replace one of the values containing a ","
#test$Category[1]<-"a,b"
testd$Category[1]<-"Bed, Bath & Towels"
# converting to nz gives error
#nzdf.test<-as.nz.data.frame(test)
nzdf.testd<-as.nz.data.frame(testd)
#remove ","
test$Category <- gsub(",","",test$Category)
# converting to nz dataframe, gives no error
nzdf.test<-as.nz.data.frame(test)
【问题讨论】:
-
显示您的 R 代码并告诉我们您正在使用哪些库。
-
@ScottMcG 使用所需的详细信息编辑了问题