Taka Matzmoto wrote:
> Dear R-users,
> 
> I have a data.frame having NA (e.g., 2nd, 4th rows, etc).
> 
>      Start End   Length Variable_name
> [1,] "1"   "1"   "1"    "a"
> [2,] NA    NA    NA     ""
> [3,] "2"   "2"   "1"    "b"
> [4,] NA    NA    NA     ""
> [5,] "3"   "6"   "4"    "c"
> [6,] "7"   "10"  "4"    "d"
> :
> :
> :
> 
> I like to remove the rows having NA in the first column ("Start")
> What is the most elegant way to do this? I think I can use for loop to 
> remove.
> I am looking for a better way.


newX <- X[!is.na(X[,1]),]

Uwe Ligges



> Thanks
> 
> Taka,
> 
> _________________________________________________________________
> 
> Hotmail.
> 
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to