Skip to content

na.omit.xts unsupported type error

6 messages · Jeff Ryan, Worik Stanton, Joshua Ulrich

#
Friends

I cannot see what I am doing wrong.

I have xts

 > Q.x
            return                 colour
1977-01-05 "0.00657131520848225"  "RED"
1977-01-06 "-0.012214299603114"   "RED"
1977-01-10 "-0.0104483453737235"  "RED"
1977-01-12 "-0.012253432045205"   "RED"
1977-01-17 "-0.00435933050375995" "RED"
1977-01-19 "0.00186556754505644"  "RED"

 > na.omit(Q.x)
Error in na.omit.xts(Q.x) : unsupported type

 > class(Q.x)
[1] "xts" "zoo"

I know there are no NAs in Q.x, but na.omit should still work surely?

cheers
Worik
#
On Mon, May 16, 2011 at 5:59 PM, Worik Stanton <worik.stanton at gmail.com> wrote:
You're not doing anything wrong, but the error tells you exactly
what's going on.  na.omit.xts doesn't currently support character
vectors.

Best,
--
Joshua Ulrich  |  FOSS Trading: www.fosstrading.com
#
Yes, currently only logical, integer and reals are supported at the C level. Mostly due to time/demand constraints.  

Since changing it, you are the first to mention it - so my suspicion is that it is reasonable. That said, I will add what I can in the C and try an cover remaining cases in R logic around. 

I'll also add something in the docs. 

Thanks,
Jeff

Jeffrey Ryan    |    Founder    |    jeffrey.ryan at lemnica.com

www.lemnica.com
On May 16, 2011, at 7:02 PM, Joshua Ulrich <josh.m.ulrich at gmail.com> wrote:

            
#
On 17/05/11 12:02, Joshua Ulrich wrote:
Okidoki.  I can manage.
If it is only me, why bother.  An error message that said what column 
the unsupported type was in would have helped.  That may be more 
straightforward?
Duh!  I did not even check ?na.omit.xts!

Thanks for the help, I can cope splendidly from here!

cheers
Worik
#
Dang!

 > Q.x[,1] <- as.numeric(Q.x[,1])
 > na.omit(Q.x[,1])
Error in na.omit.xts(Q.x[, 1]) : unsupported type

That is surprising.  Any ideas why I cannot coerce it to numeric?

 > Z.x <- xts(as.numeric(Q.x[,1]), index(Q.x))
 > Z.x
                    [,1]
1977-01-05  0.006571315
1977-01-06 -0.012214300
1977-01-10 -0.010448345
1977-01-12 -0.012253432
1977-01-17 -0.004359331
1977-01-19  0.001865568

That works.  So I have no crises, but it is odd.

W
On 17/05/11 12:02, Joshua Ulrich wrote:
#
On Mon, May 16, 2011 at 8:31 PM, Worik Stanton <worik.stanton at gmail.com> wrote:
xts / zoo objects are a matrix with an index attribute.  You can't mix
types in a matrix.
Best,
--
Joshua Ulrich  |  FOSS Trading: www.fosstrading.com