samedi 24 novembre 2018

Convert salient vectors to a single data frame in R

+if(p==0.3){
+x=x+1
+y=y+1              
+z=z+1                      
+time=time+1                        
+df <- c(t,x,y,z)
+print.data.frame(df)
+}

--result (accumulation of data.frames)

       t  x  y  z 
1      1 -1 -1 -1    
       t  x  y  z 
1      2 -2 -2 -2  

I want:

       t  x  y  z 
1      1 -1 -1 -1    
2      2 -2 -2 -2 

How I could convert it into a single data.frame? The structure is in a loop while that generates random values 0-1. So, the result of the function is a set of vectors of 4 positions.

Aucun commentaire:

Enregistrer un commentaire