L.Vaiz - 1 year ago 109

R Question

Im kind a new programming in R, and even more programming in c++. I was trying to develop a program in R to estimate a Spearman correlation with the Rcpp tool and the C++ developer. I did it, but it only works with matrix with less of a range between 45 00 - 50 000 vectors. I dont know why, but it only works with that dimension. I suppose thereĀ“s limit with that type of information, maybe if i work it like a dataframe? I would really apreciate if you someone gives me a hindsight. Thanks!

Answer Source

To repeat more succintly:

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

Matrices are vectors with

`dim`

attributes.You can have more than 2^31-1 elements in a matrix (ie

`n`

times`k`

)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>
```