Re: [R] Manipulation of data.frame into an array

2018-05-24 Thread Rui Barradas
: Re: [R] Manipulation of data.frame into an array This is one of those instances where a less superficial knowledge of R's technical details comes in really handy. What you need to do is convert the data frame to a single (numeric) vector for, e.g. a matrix() call. This can be easily done by

Re: [R] Manipulation of data.frame into an array

2018-05-24 Thread MacQueen, Don via R-help
rt Gunter Sent: 24 May 2018 16:04 To: Ioanna Ioannou Cc: r-help@r-project.org Subject: Re: [R] Manipulation of data.frame into an array This is one of those instances where a less superficial knowledge of R's technical details comes in really handy. What you need to d

Re: [R] Manipulation of data.frame into an array

2018-05-24 Thread Ioanna Ioannou
From: Bert Gunter Sent: 24 May 2018 16:04 To: Ioanna Ioannou Cc: r-help@r-project.org Subject: Re: [R] Manipulation of data.frame into an array This is one of those instances where a less superficial knowledge of R's technical details comes in really handy. What you need to do is conver

Re: [R] Manipulation of data.frame into an array

2018-05-24 Thread Gerrit Eichner
Why not use as.matrix(Imp) in this case? Regards -- Gerrit Am 24.05.2018 um 17:04 schrieb Bert Gunter: This is one of those instances where a less superficial knowledge of R's technical details comes in really handy. What you need to do is convert the data frame to a single (numeric) vector

Re: [R] Manipulation of data.frame into an array

2018-05-24 Thread Bert Gunter
This is one of those instances where a less superficial knowledge of R's technical details comes in really handy. What you need to do is convert the data frame to a single (numeric) vector for, e.g. a matrix() call. This can be easily done by noting that a data frame is also a list and using do.ca

Re: [R] Manipulation of data.frame into an array

2018-05-24 Thread Rui Barradas
Hello, I am not sure I understand the question, but see if the following is what you want. split(Imputed, cumsum(c(0, diff(Imputed$Y) != 1))) Hope this helps, Rui Barradas On 5/24/2018 3:46 PM, Ioanna Ioannou wrote: Hello everyone, I want to transform a data.frame into an array (lets

[R] Manipulation of data.frame into an array

2018-05-24 Thread Ioanna Ioannou
Hello everyone, I want to transform a data.frame into an array (lets call it mydata), where: mydata[[1]] 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(