L.Vaiz - 1 year ago 92

R Question

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. I don't 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 data.frame? I would really appreciate if someone gives me insight.

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