Is there a limit on working with matrix in R with Rcpp?

前端 未结 2 815
隐瞒了意图╮
隐瞒了意图╮ 2021-01-23 17:26

I was trying to develop a program in R to estimate a Spearman correlation with Rcpp. I did it, but it only works with matrix with less of a range between 45 00 - 50 000 vectors.

2条回答
  •  悲哀的现实
    2021-01-23 18:03

    To repeat more succintly:

    1. You can have more than 2^31-1 elements in a vector.

    2. Matrices are vectors with dim attributes.

    3. You can have more than 2^31-1 elements in a matrix (ie n times k)

    4. Your row and column index are still limited to 2^31.

    Example of a big vector:

    R> n <- .Machine$integer.max + 100
    R> tmpVec <- 1:n
    R> length(tmpVec)
    [1] 2147483747
    R> newVec <- sqrt(tmpVec)
    R> 
    

提交回复
热议问题