Dear All,

I'm trying to write a function in the values of some numeric vectors
(d1,d2,...,d(m-1)). This function  should be applied on some combinations
of the elements of the (m-1) d vectors that satisfy the condition of having
a sum less than or equal to (n-m). I've tried the following code, but got
an error:(subscript) logical subscript too long.

> n=20

> m=6

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

> s<-w[rowSums(ED)<=(n-m),]

Error in w[rowSums(ED) <= (n - m), ] :

  (subscript) logical subscript too long


Bearing in mind that the true values of n and m might be way larger than 20
and 6, consecutively.

Any Suggestions please?
Thanks.

Maram

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to