Hello, I have to remove NAs from a logical xts, but I get the error: Error in na.omit.xts(x > y) : unsupported type Example code: library(xts) x = xts(1:10,as.Date(1:10)) y = xts(c(NA,9:1),as.Date(1:10)) na.omit(x > y) What I am missing? Kind regards, Fabrizio Pollastri
xts and na.omit "unsupported type"
4 messages · Fabrizio Pollastri, Brian G. Peterson, Jeff Ryan
Fabrizio Pollastri wrote:
Hello, I have to remove NAs from a logical xts, but I get the error: Error in na.omit.xts(x > y) : unsupported type Example code: library(xts) x = xts(1:10,as.Date(1:10)) y = xts(c(NA,9:1),as.Date(1:10)) na.omit(x > y)
x>y is a logical comparison. na.omit want s a single series as an argument.
so, cbind your series first, na.omit, and then compare
or skip all that and do:
x[which(x>y)]
and please note that this was a question for r-help, not R-SIG-Finance,
as it has nothing to do with finance.
Regards,
- Brian
Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock
Actually more a question for the developers :) Seems to be a bug in the code. I will fix. For now, Brian's suggestion is best. Thanks, Jeff
On Thu, Dec 10, 2009 at 8:23 AM, Brian G. Peterson <brian at braverock.com> wrote:
Fabrizio Pollastri wrote:
Hello, I have to remove NAs from a logical xts, but I get the error: Error in na.omit.xts(x > y) : unsupported type Example code: library(xts) x = xts(1:10,as.Date(1:10)) y = xts(c(NA,9:1),as.Date(1:10)) na.omit(x > y)
x>y is a logical comparison. na.omit want s a single series as an argument. so, cbind your series first, na.omit, and then compare or skip all that and do: x[which(x>y)] and please note that this was a question for r-help, not R-SIG-Finance, as it has nothing to do with finance. Regards, ? - Brian -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
Jeffrey Ryan jeffrey.ryan at insightalgo.com ia: insight algorithmics www.insightalgo.com
Just a quick update. This has been patched in the R-forge repos. A new version for CRAN will be out soon. Thanks, Jeff
On Thu, Dec 10, 2009 at 9:07 AM, Jeff Ryan <jeff.a.ryan at gmail.com> wrote:
Actually more a question for the developers :) Seems to be a bug in the code. ?I will fix. For now, Brian's suggestion is best. Thanks, Jeff On Thu, Dec 10, 2009 at 8:23 AM, Brian G. Peterson <brian at braverock.com> wrote:
Fabrizio Pollastri wrote:
Hello, I have to remove NAs from a logical xts, but I get the error: Error in na.omit.xts(x > y) : unsupported type Example code: library(xts) x = xts(1:10,as.Date(1:10)) y = xts(c(NA,9:1),as.Date(1:10)) na.omit(x > y)
x>y is a logical comparison. na.omit want s a single series as an argument. so, cbind your series first, na.omit, and then compare or skip all that and do: x[which(x>y)] and please note that this was a question for r-help, not R-SIG-Finance, as it has nothing to do with finance. Regards, ? - Brian -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock
_______________________________________________ R-SIG-Finance at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first.
-- Jeffrey Ryan jeffrey.ryan at insightalgo.com ia: insight algorithmics www.insightalgo.com
Jeffrey Ryan jeffrey.ryan at insightalgo.com ia: insight algorithmics www.insightalgo.com