[R] Manipulation of data.frame into an array
ii54250 @ending from m@n@com
Thu May 24 16:46:50 CEST 2018
I want to transform a data.frame into an array (lets call it mydata), where: mydata[] is the first imputed dataset...and for each mydata[[d]], the first p columns are covariates X, and the last one is the outcome Y.
Lets assume a simple data.frame:
Imputed = data.frame( X1 = c(1,2,1,2,1,2,1,2, 1,2,1,2,1,2,1,2),
X2 = c(0,1,0,1,1,1,0,1, 0,1,0,1,1,1,0,1),
Y = c(1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8))
The first 8 have been obtained by the first imputation and the later 8 by the 2nd.
Can you help me please?
[[alternative HTML version deleted]]
More information about the R-help