0

我正在 Azure / R-server 中进行 kmeans 集群,并且需要能够编写没有标头的文件。

到目前为止,我已经尝试过:

k1 <- rxKmeans(formula = ~ var1 + var2 + var3, data = df, seed = 10, numClusters = 5
               , outFile = dfOut, extraVarsToWrite = c('CUST_ID'), overwrite = T
                , outColName = F
)

我得到这个错误:

Error in rxuHandleClusterJobTryFailure(retObject, hpcServerJob, autoCleanup) : 
  Error completing job on cluster:
Error : rxIsCharacterScalarNonEmpty(outColName) is not TRUE

我也试过:

k1 <- rxKmeans(formula = ~ var1 + var2 + var3, data = df, seed = 10, numClusters = 5
               , outFile = dfOut, extraVarsToWrite = c('CUST_ID'), overwrite = T
                , header = F
)

返回:

Error in rxuHandleClusterJobTryFailure(retObject, hpcServerJob, autoCleanup) : 
  Error completing job on cluster:
Error in rxKmeansBase(formula = formula, data = data, outDataSource = outDataSource,  : 
  unused argument (header = FALSE)

还有其他建议吗?

4

1 回答 1

1

问题是我在文件定义和 rxKmeans 函数中给出了相互矛盾的指令。

我通过省略headerrxKmeans 函数中的参数并将其设置firstRowIsColNames为 FALSE 来修复它。

kmeansFile <- paste('~/clusters/ClusterOutput.tsv', sep = '')
dfOut <- RxTextData(kmeansFile, fileSystem = hdfsFS, firstRowIsColNames = F)

k1 <- rxKmeans(formula = ~ var1 + var2 + var3, data = df, seed = 10, numClusters = 5
               , outFile = dfOut, extraVarsToWrite = c('id_num'), overwrite = T
               # , outColName = F
               # , header = F
)
于 2017-11-13T18:48:53.930 回答