Search code examples
rdatecsvoctavemanpage

Should I use R or Octave for date manipulation in csv file?


I wish to perform date manipulation of an imported csv file with the first column being a date column of the format dd/mm/yyyy and I wish to use either R or Octave for this as after this date manipulation I will need to do various matrix/vector operations on the rest of the data, dependent upon these dates.

The dates in the imported csv file will NOT include weekends and there will also invariably be some other missing dates and what I wish to do is check the file and insert all these missing dates plus weekends such that the date column is completely contiguous from beginning to end, with no missing dates, and with "dummy" empty values associated with these inserted dates to be written appropriately in the resultant matrix. Which of R or Octave should I use for ease of doing this? I know that using Octave to do this would be very tricky, but I don't know about R. Ultimately all dates and data will be written to another named text file for subsequent plotting in Gnuplot.

Additionally, if someone could give hints as to which date functions I would need to use, how to approach this problem etc. that would be great.


Solution

  • It sounds as though you are dealing with financial data. The R packages zoo, xts, and quantmod should probably be reviewed because they offer worked solution to common data processing tasks in this area. There are other packages that define financial calendars. There is an R-SIG mailing list devoted to this topic as well. Even if you are dealing wihth some other real-world scenario that has data restricted to non-holiday weekdays, you are still going to find useful functionality in those packages for the task you (rather vaguely) have outlined.

    Doing a search on SO for "[r] finance calendar" brings up this potentially relevant hit as well as several others.