[R] (subscript) logical subscript too long

Giorgio Garziano giorgio.garziano at ericsson.com
Thu Oct 1 14:27:52 CEST 2015


If you are running a 32-bit Windows, there are following upper limits:

https://cran.r-project.org/bin/windows/base/rw-FAQ.html#There-seems-to-be-a-limit-on-the-memory-it-uses_0021


starts by:

memory.limit(size=1920)

and try increasing value of size as a parameter for memory.limit().


I use Intel i5 Windows-7 64-bit 16GB RAM.


GG



From: Maram SAlem [mailto:marammagdysalem at gmail.com]
Sent: giovedì 1 ottobre 2015 14:12
To: Giorgio Garziano
Cc: r-help at r-project.org
Subject: Re: [R] (subscript) logical subscript too long

Thanks a lot Giorgio, I used

memory.limit(size=4096)

but got

 don't be silly!: your machine has a 4Gb address limit

I'm working on my Ph.D. thesis and I have a huge code of which this is just a very small part, so does this error mean that I need a new computer with extended capabilites to be able to execute my code?? I'm currently using intel core i3, windows 7

Thanks for helping.

Maram


On 1 October 2015 at 13:37, Giorgio Garziano <giorgio.garziano at ericsson.com<mailto:giorgio.garziano at ericsson.com>> wrote:
Check your memory size by:

memory.limit()

try to increase it by:

memory.limit(size=4096)



From: Maram SAlem [mailto:marammagdysalem at gmail.com<mailto:marammagdysalem at gmail.com>]
Sent: giovedì 1 ottobre 2015 13:22
To: Giorgio Garziano
Cc: r-help at r-project.org<mailto:r-help at r-project.org>
Subject: Re: [R] (subscript) logical subscript too long

Thanks Giorgio, I got it.

 I managed to reach the matrix s whose rows represent  all the possible combinations. Here is the code:

> n=12
> m=7
> D<-matrix(0,nrow=n-m+1,ncol=m-1)
> for (i in 1:m-1)
+  {
+ D[,i]<-seq(0,n-m,1)
+  }
> ED <- do.call(`expand.grid`,as.data.frame(D))
> ED<-as.matrix(ED)
> lk<-which(rowSums(ED)<=(n-m))
> s<-ED[lk,]

The problem now is that the code works only for relatively small values of n and m, but when I use, for ex., n=20 and m=9, I got this error

> n=20
> m=9
> D<-matrix(0,nrow=n-m+1,ncol=m-1)
> for (i in 1:m-1)
+  {
+ D[,i]<-seq(0,n-m,1)
+  }
> ED <- do.call(`expand.grid`,as.data.frame(D))

Error: cannot allocate vector of size 1.6 Gb

Any Suggestions please?

Thanks Again.
Maram

On 30 September 2015 at 17:41, Giorgio Garziano <giorgio.garziano at ericsson.com<mailto:giorgio.garziano at ericsson.com>> wrote:
Be:

log <- (rowSums(ED) <= (n - m))


Compare the following two values:





length(log)





nrow(w)





--

GG


        [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org<mailto:R-help at r-project.org> mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



	[[alternative HTML version deleted]]



More information about the R-help mailing list