[R] Saving each output of a loop into something that can be graphed

RRRRRR99 redhwanzaman at hotmail.com
Mon Oct 5 08:27:42 CEST 2009


Hi, 

from the code below; whats happening is i want to plot how the [1,9] entry
changes as the matrx changes, print[] gives the values one after the other,
but only the last value is saved so my graph has only one point. does anyone
know how i can merge all the outputs into one dataframe or something?

Q<-matrix(c(-0.59,5.44,0,0,0,0,0,0,0,0.59,-8.16,2.51,0,0,0,0,0,0,0,2.72,-5.64,9.45,0,0,0,0,0,0,0,3.13,-13.23,6.91,0,0,0,0,0,0,0,3.15,-14.88,10.22,0,0,0,0,0,0,0.63,7.97,-19.81,30.19,0,96.77,0,0,0,0,0,7.67,-98.12,0,19.35,0,0,0,0,0,0,37.74,-315.79,0,0,0,0,0,0,1.92,30.19,315.79,-116.12),nrow=9,ncol=9)
T<-Q*.01
for (i in (1:10)){
R<-MatrixExp(i*T)
S<-print(R[1,9])
}


any help would be greatly appreciated.
-- 
View this message in context: http://www.nabble.com/Saving-each-output-of-a-loop-into-something-that-can-be-graphed-tp25745700p25745700.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list