Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

As a task for my Financial eco assignment I had to plot a simple time series of the overnight MIBOR(Mumbai interbank offer rates) for the past one year . The job could very well have been done easily in MS-Excel but I choose to plot it in R instead and the quality of the graph, pixel-wise and neatness wise, was way better than what I could have obtained with MS-Excel. All this at the cost of a minimal 3 lines of code:

# The overnight MIBOR rates were stored in a file name “Call_Rates_2011.csv”, this is just a normal Excel file saved in a CSV(comma separated delimited) format that R can read.
# The way in which R conceptualizes the data is similar to that in Excel, to draw a simple analogy you can assume that the variable “a” now stores the entire Excel spreed sheet in it.
# You will have to make sure that the working directory is the one that contains the file “Call_Rates_2011.csv”

# The 2 column headers in my CSV file were “date” and “mibor”, so the below code plots “date” on the x-axis and “mibor” on the y-axis. The as.Date() tells R that the column “date” contains dates in the format “day-month-year”(‘%d-%b-%y’).
# a$(column header) is the standard way of referring to a column in the “spreadsheet” contained in “a” # xlab : x-axis label # ylab : y- axis label # type : line(l) # col : color of the line plot(as.Date(a$date,’%d-%b-%y’), a\$mibor, xlab= “Months”, ylab= “MIBOR overnight rates(percentage)”, type=’l’, col=’red’)

# This is to get the titles in place
# main : main title
# col.main : color of the main title
#font.main : font size of the title

title(main=”Overnight MIBOR rates for last one year”, col.main=”black”, font.main=4)

And the plot hence obtained thus looks like:

Incase you can’t make out the difference in the quality of the plot obtained just drop in your comments and email address and I will mail you the pdf and the jpg image of the plot. You can pull/stretch it to see that the pixels don’t get distorted and it looks way neater if you present it in your slide in a presentation.