I have got CSV files which has the Date in the following format:
25-Aug-2004
I want to read it as an “xts” object so as to use the function “periodReturn” in quantmod package.
Can I use the following file for the function?
Symbol Series Date Prev.Close Open.Price High.Price Low.Price
1 XXX EQ 25-Aug-2004 850.00 1198.70 1198.70 979.00
2 XXX EQ 26-Aug-2004 987.95 992.00 997.00 975.30
Guide me with the same.
Unfortunately I can’t speak for the
tspart, but this is how you can convert your dates to a proper format that can be read by other functions as dates (or time).You can import your data into a data.frame as usual (see here if you’ve missed it). Then, you can convert your
Datecolumn into aPOSIXlt(POSIXt) class usingstrptimefunction.