[R-SIG-Finance] Problems with xts and plotting charts in quantmod
Brian G. Peterson
brian at braverock.com
Thu Feb 5 19:24:48 CET 2015
at least part of your problem now is that you're storing the data as
character, rather than numeric.
in your as.xts call, you'll want to remove the first column in the 'x'
argument,
e.g.
y <- as.xts(x[,-1], order.by=as.POSIXct(x[,1],...))
# the above is not reproducible, it is missing the format argument at least
I also see that you have spaces in your character data, so you may need
an as.numeric in there too.
Another way to do it would be to make sure that read.csv sees the
columns as numbers rather than character, which proably has to do with
your choice of separator.
Regards,
Brian
On 02/05/2015 10:44 AM, Liu wrote:
> I appreciate your help and contribution. I followed the above codes and
> encountered an error:
> *Error in na.omit.xts(x) : unsupported type*
>
> I found other's post on SO with my similar question but unfortunately no
> solution yet:
> http://stackoverflow.com/questions/28255994/error-in-na-omit-xtsx-unsupported-type-with-chartseries
>
> Just post the output here to see if you can see the problem:
>
>> >chartSeries(data.xts,subset="2015-01",type="candlesticks")
> *Error in na.omit.xts(x) : unsupported type*
>> >head(data.xts)
> Date Time Open High Low Close
>
> 2009-03-15 17:00:00 "20090315 170000" " 929.60" " 929.60" " 929.60" "
> 929.60"
--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock
More information about the R-SIG-Finance
mailing list