0

我正在从文件中读取一些映射。那么,在使用这个值的时候会出现一个奇怪的现象:

k <- 66
mapp[k,]
> 66   61    2.345

mapp[k,1] == 66
> TRUE

dat[1,66]
> 5

dat[1, as.numeric(mapp[k,1])]
> 7

So, for some strange reason everything points to the fact that mapp[k,1] has the value 66, but when selecting the column of the matrix it is not recognizes as this value!? 为什么?我尝试通过尝试参数“stringsAsFactors”来读取映射,但这没有帮助。

有人知道吗?

4

1 回答 1

0

好吧,这是由于 R 将其解释为因子,所以 mapp[k,1] 的值是 364,可能是各个因子的索引。

问题解决了!

于 2012-12-12T18:47:12.223 回答