[R] keep adding elements to the matrix

Nick Sabbe nick.sabbe at ugent.be
Wed Oct 27 16:54:45 CEST 2010


Hello Alex.

I'm a bit confused by your english, but what I guess you want is:
x<-final[-1] - final[-length(final)]
y<-2*final[-1]

result<-cbind(x=x, y=y)

Good luck.


Nick Sabbe
--
ping: nick.sabbe at ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36

-- Do Not Disapprove




-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Alaios
Sent: woensdag 27 oktober 2010 16:38
To: Rhelp
Subject: [R] keep adding elements to the matrix

Hello everyone,
I would like to create a "dynamic" array to keep storing number in it

for (i in c(2:length(final))){
    myarray <-final[i]-final[i-1]
    myarray2<-2*final[i]  
  }



At the end I would like to use myarray as the x values of an array
and the myarray2 as the yvalues of the same array.
I tried cbind but it didnot work.

Could you please help me with that?

Best Regards
Alex



      
	[[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.



More information about the R-help mailing list