Dear all, I am into following coding:
> library(quantmod)
> Data1 <- get(getSymbols("TCS.NS", from = as.Date("2008-01-01"),
return.class = "zoo"))[,4]
Warning messages:
1: In zoo(cd, order.by = index(x), ...) :
some methods for ?zoo? objects do not work if the index entries in
?order.by? are not unique
2: In zoo(rval, index(x)[i]) :
some methods for ?zoo? objects do not work if the index entries in
?order.by? are not unique
Here, I guess there are some duplicated dates-index. Is there any
function available to automatically extract unique indices ???
Thanks and regards,
How to extract unique indices for time series Data?
4 messages · Christofer Bogaso, Bert Gunter, Gabor Grothendieck +1 more
?unique ?duplicated -- Bert On Sat, Jul 28, 2012 at 12:57 PM, Christofer Bogaso
<bogaso.christofer at gmail.com> wrote:
Dear all, I am into following coding:
library(quantmod)
Data1 <- get(getSymbols("TCS.NS", from = as.Date("2008-01-01"),
return.class = "zoo"))[,4]
Warning messages: 1: In zoo(cd, order.by = index(x), ...) : some methods for ?zoo? objects do not work if the index entries in ?order.by? are not unique 2: In zoo(rval, index(x)[i]) : some methods for ?zoo? objects do not work if the index entries in ?order.by? are not unique Here, I guess there are some duplicated dates-index. Is there any function available to automatically extract unique indices ??? Thanks and regards,
______________________________________________ R-help at r-project.org mailing list 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.
Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
On Sat, Jul 28, 2012 at 3:57 PM, Christofer Bogaso
<bogaso.christofer at gmail.com> wrote:
Dear all, I am into following coding:
library(quantmod)
Data1 <- get(getSymbols("TCS.NS", from = as.Date("2008-01-01"),
return.class = "zoo"))[,4]
Warning messages: 1: In zoo(cd, order.by = index(x), ...) : some methods for ?zoo? objects do not work if the index entries in ?order.by? are not unique 2: In zoo(rval, index(x)[i]) : some methods for ?zoo? objects do not work if the index entries in ?order.by? are not unique Here, I guess there are some duplicated dates-index. Is there any function available to automatically extract unique indices ???
Try this:
library(quantmod)
Data1 <- Cl(getSymbols("TCS.NS", from = as.Date("2008-01-01"),
auto.assign = FALSE))
dup <- duplicated(time(Data1), fromLast = TRUE)
z <- as.zoo(Data1[!dup])
Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120728/02bc7d57/attachment.pl>