I read enourmous comment about this questions stating that it was answered 
before. 
I have been looking for the answer for a week without luck !!! 
I searched the archives the xts. vignitte , googled for an answer but couldn't 
find one so her it is: 
 
the Vignette states that xts "doesn't inforce the duplicate row requirement" 
but yet when I try to bring in tick stock data from a data frame as.xts it 
complains that the string is in an ambigious format.
 
The date and time were in two separate columns I corrected that using excel and 
put them both in one column and saved the file as a text file in which the 
first column became similar to the example below.  tried to read the table 
directly, didn't work, I brought in the data as a data.frame() then tried to 
convert it, that didn't work either
 
bellow is an example of how my data looks it has more than 2 columns, but the 
important column is the first one,  the second column "xxx" is price: 
 
2011-02-10 12:21:05     xxx
2011-02-10 12:21:05     xxx
 
Then I found out that zoo would allow me to bring the data in with the 
duplicates it will ask you to fix it but atleast I would havce a zoo object.  I 
thought I could trick it this way by bring it as zoo, then convert it to 
xts with the as.xts function      that didn't work either
 
I read a solution about using make.unique function I tried it with the code 
bellow, that didn't work
 
aapl<- make.index.unique(as.xts(read.table("C:\\Data Files\\new\\aapl.txt"))) 
 
part of the confusion with the "unique" function was should I wrape the xts 
object with it or should I wrap it (unique) within the xts, I didn't know the 
order so I tried both, and neithe worked
 
So I gave up !!How can I bring in a txt file into R as an xts object when I 
have duplicate rows on seconds knowing I dont have fractions of seconds? Do we 
have to use the unique function or is it true that xts doesn't enforce the 
unique date requirement?
 
Please provide code example based on the code line in blue and (aapl stock 
data) and date format above.
 
Thanks in advance

______________________________________________
R-help@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.

Reply via email to