[R] removing NA from an its object
Laura Holt
lauraholt_983 at hotmail.com
Tue Jun 29 18:26:23 CEST 2004
Hi again!
I have the following its object:
>class(x1)
[1] "its"
attr(,"package")
[1] "its"
>x1
FTSE DAX
2004-06-07 4491.6 4017.81
2004-06-08 4504.8 4018.95
2004-06-09 4489.5 3997.76
2004-06-10 4486.1 4021.64
2004-06-11 4484.0 4014.56
2004-06-14 4433.2 3948.65
2004-06-15 4458.6 3987.30
2004-06-16 4491.1 4003.24
2004-06-17 4493.3 3985.46
2004-06-18 4505.8 3999.79
2004-06-21 4502.2 3989.31
2004-06-22 NA 3928.39
2004-06-23 NA 3945.10
2004-06-24 NA 4007.05
2004-06-25 NA 4013.35
2004-06-28 NA 4069.35
I want to create an its object with no NAs; that is, if there is an NA in
any column, strike the entire row.
I did the following:
>x2 <- its(na.omit(x1))
>x2
FTSE DAX
2004-06-07 4491.6 4017.81
2004-06-08 4504.8 4018.95
2004-06-09 4489.5 3997.76
2004-06-10 4486.1 4021.64
2004-06-11 4484.0 4014.56
2004-06-14 4433.2 3948.65
2004-06-15 4458.6 3987.30
2004-06-16 4491.1 4003.24
2004-06-17 4493.3 3985.46
2004-06-18 4505.8 3999.79
2004-06-21 4502.2 3989.31
attr(,"na.action")
2004-06-22 2004-06-23 2004-06-24 2004-06-25 2004-06-28
12 13 14 15 16
attr(,"class")
[1] "omit"
>class(x2) <- "its"
>
My question: is this the best way to accomplish the goal, please? I tried
apply with "all" and is.na but I got strange results.
Thanks.
R Version 1.9.1
Sincerely,
Laura
mailto: lauraholt_983 at hotmail.com
Married. http://lifeevents.msn.com/category.aspx?cid=married
More information about the R-help
mailing list