我正在读取数据特征
data_features<-as.matrix(read.table("file.csv", header=TRUE,fill=TRUE));然后转换为矩阵并使用函数库去除Inf数据。
dd <-as.matrix(data_xls)
dd[apply(dd, 1, Compose(is.finite, all)),]然后我执行rcorr:
rcorr(dd)这会导致:
Error in rcorr(dd) : NA/NaN/Inf in foreign function call (arg 1)
In addition: Warning message:
In storage.mode(x) <- "double" : NAs introduced by coercion如果不使用Compose from functional,我在创建矩阵时就会遇到这个问题。目前,我在创建矩阵时没有,但之后在执行rcorr时就有了。
发布于 2014-11-27 15:31:02
通常,这是因为数据框中有一些单元格的NA、NaN或Inf值。您可以通过使用谓词is.na(x)、is.nan(x)上的页面和is.infinity(x)来删除此值。enter link description here
发布于 2015-05-04 18:18:16
下面是一个较晚的答案:我也遇到了同样的问题,结果是我的数字格式不被函数接受。我的ex是1'203而不是1203。这导致了错误。转换为普通数字格式起作用。希望这能有所帮助
https://stackoverflow.com/questions/22019975
复制相似问题