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
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
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
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
4 matches
Mail list logo