Re: [R] split data with missing data condition

2010-10-15 Thread Henrique Dallazuanna
Try this: split(as.data.frame(DF), is.na(DF$x)) On Fri, Oct 15, 2010 at 9:45 AM, Jumlong Vongprasert wrote: > Dear all > I have data like this: > x y > [1,] 59.74889 3.1317081 > [2,] 38.77629 1.7102589 > [3,] NA 2.2312962 > [4,] 32.35268 1.3889621 > [5,] 74

Re: [R] split data with missing data condition

2010-10-15 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 15.10.2010 15:00:46: > you can do the following: > > mat <- cbind(x = runif(15, 50, 70), y = rnorm(15, 2)) > mat[sample(15, 2), "x"] <- NA > > na.x <- is.na(mat[, 1]) > mat[na.x, ] > mat[!na.x, ] Or if you have missing data in several columns and you

Re: [R] split data with missing data condition

2010-10-15 Thread jim holtman
Try this: > a <- read.table(textConnection(" x y + 59.74889 3.1317081 + 38.77629 1.7102589 +NA 2.2312962 + 32.35268 1.3889621 + 74.01394 1.5361227 + 34.82584 1.1665412 + 42.72262 2.7870875 + 70.54999 3.3917257 + 59.37573 2.6763249 + 68.87422 1.96977

Re: [R] split data with missing data condition

2010-10-15 Thread Dimitris Rizopoulos
you can do the following: mat <- cbind(x = runif(15, 50, 70), y = rnorm(15, 2)) mat[sample(15, 2), "x"] <- NA na.x <- is.na(mat[, 1]) mat[na.x, ] mat[!na.x, ] I hope it helps. Best, Dimitris On 10/15/2010 2:45 PM, Jumlong Vongprasert wrote: Dear all I have data like this: x

[R] split data with missing data condition

2010-10-15 Thread Jumlong Vongprasert
Dear all I have data like this: x y [1,] 59.74889 3.1317081 [2,] 38.77629 1.7102589 [3,] NA 2.2312962 [4,] 32.35268 1.3889621 [5,] 74.01394 1.5361227 [6,] 34.82584 1.1665412 [7,] 42.72262 2.7870875 [8,] 70.54999 3.3917257 [9,] 59.37573 2.67632