Dear Rex
 
Thanks very much for pointing me in the right direction. Works like a charm :)
 
regards
 
Sean
 

________________________________
 From: rex <rex@nosyntax.net>
To: r-sig-finance@r-project.org 
Sent: Thursday, September 27, 2012 11:20 AM
Subject: Re: [R-SIG-Finance] Reversing date order in CSV file
  

>data<-read.csv("http://ichart.finance.yahoo.com/table.csv?s=INFY.BO&a=08&b=16&c=2008&d=08&e=26&f=2012&g=d&ignore=.csv")
>head(data)
>
>How do I sort the data in reverse i.e the oldest data first. I could open the CSV file in excel and sort decending but is there a line in R I could incorporate to reverse it.

I'd use quantmod.

library(quantmod)
getSymbols('INFY.BO', from='2008-01-01')
head(INFY.BO)
            INFY.BO.Open INFY.BO.High INFY.BO.Low INFY.BO.Close INFY.BO.Volume INFY.BO.Adjusted
2008-01-01       1758.0      1777.15     1743.00       1749.70          51700          1639.38
2008-01-02       1780.0      1785.00     1715.35       1749.40          86700          1639.10
2008-01-03       1740.0      1750.00     1691.60       1713.00         214300          1605.00
2008-01-04       1711.3      1730.00     1680.00       1694.80         134400          1587.94
2008-01-07       1670.0      1681.00     1623.00       1638.10         307500          1534.82
2008-01-08       1651.0      1694.60     1623.20       1662.15         253400          1557.35

class(INFY.BO)
[1] "xts" "zoo"

Which is probably what you want rather than a data.frame.

HTH,

-rex
-- 
Q:  Why do mountain climbers rope themselves together?
A:  To prevent the sensible ones from going home.

_______________________________________________
R-SIG-Finance@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
	[[alternative HTML version deleted]]

