Skip to content
Prev 374787 / 398506 Next

Manipulation of data.frame into an array

Hello,

I still don't understand, my code returns each imputation in a separate 
data.frame.

mydata <- split(Imputed, cumsum(c(0, diff(Imputed$Y) != 1)))
mydata[[1]]
#  X1 X2 Y
#1  1  0 1
#2  2  1 2
#3  1  0 3
#4  2  1 4
#5  1  1 5
#6  2  1 6
#7  1  0 7
#8  2  1 8


And mydata[[2]] will be the other imputation.

If this is not what you want, can you please post an example output 
mydata[[1]] from the database you have posted?

Rui Barradas
On 5/24/2018 4:14 PM, Ioanna Ioannou wrote: