[R-SIG-Finance] na.omit.xts unsupported type error
Worik Stanton
worik.stanton at gmail.com
Tue May 17 03:31:51 CEST 2011
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 5:59 PM, Worik Stanton<worik.stanton at gmail.com> wrote:
>> 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
>>
> 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
>
More information about the R-SIG-Finance
mailing list