[R] request: An array declarion problem

From: Muhammad Azam <mazam72_at_yahoo.com>
Date: Tue, 03 Jun 2008 10:58:23 -0700 (PDT)

Dear R users
I tried a lot to solve the following problem but could not. I have two arrays having same order i.e 1 by 150.

j=10; ss=150; r=array(0 , c( j , ss )); rr=array(0 , c( j , ss )); r1=array(0 , c( j-1 , ss )); r2=array(0 , c( j-1 , ss )); r3=array(0 , c( 2 , ss ))

for(i in 1:j-1){

                        r1[ i , ] <- r[ j+1, ]-r[ j, ]; r2[ i , ] <- rr[ j+1, ]-rr[ j, ]

Now i want to "rbind" the results of r1 and r2 for each time. Now the order of r3[ j, ] will become 2 by 150. I used the following form in the loop

r3[ i,]=rbind(r1[ i, ], r2[ i, ])

But there is an error message

Error in r3[i, ] = rbind(r1[i, ], r2[i, ]) : number of items to replace is not a multiple of replacement length

I am looking for some suggestion to solve the problem. Thanks and

best regards

Muhammad Azam
Ph.D. Student
Department of Medical Statistics,
Informatics and Health Economics
University of Innsbruck, Austria

	[[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
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. Received on Tue 03 Jun 2008 - 19:54:30 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 04 Jun 2008 - 13:30:37 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive