On Tue, Sep 22, 2015 at 3:10 PM, bgnumis bgnum <bgnumis at gmail.com>
wrote:> Hi all,
>
> I want to plot this data on file.txt that has this format
>
> 01/01/2000;970,1877
> 02/01/2000;970,2224
> 03/01/2000;969,0336
> 04/01/2000;958,3023
> 05/01/2000;952,8527
>
> I?m trying to plot with quantmode with this code but it is not working
>
>
> X<-read.table("file.txt",
col.names=c("Date","LAST"),
sep=";",dec=",")
>
>
>
>
> chartSeries(
> X,theme="white",
> TA = c(addBBands(200,2))
>
>
> )
>
> But it says on error
>
> Error in try.xts(x, error = "chartSeries requires an xtsible
object") :
> chartSeries requires an xtsible object
>
>
> How can I run chartseries with my own data?
>
Your data need to be in an xts object, or something that can be
converted to an xts object via as.xts(). I recommend the former.
Lines <-
"01/01/2000;970,1877
02/01/2000;970,2224
03/01/2000;969,0336
04/01/2000;958,3023
05/01/2000;952,8527"
library(quantmod)
X <- as.xts(read.zoo(text=Lines, sep=";", dec=",",
format="%m/%d/%Y"))
chartSeries(X, theme="white", TA="addBBands(200,2)")
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com