Monday, April 5, 2010

Getting started with R

1. Download R from http://www.r-project.org/ and install.
2. Start R and install quantmod package in R prompt.
    >install.packages(c('xts','Defaults','quantmod'))
3. Get IBM stock quote using Yahoo web site.
    >library("quantmod") or require(quantmod)
    >getSymbols("IBM") or
    >getSymbols("IBM",src="Yahoo")
4. Chart the IBM using any of the following command:
       >plot(IBM)







      >chartSeries(IBM)

5) To change to white scheme and only current year chart, use the following:
  chartSeries(IBM,theme='white',subset='2013-01::2013-07')


6)  reChart function can be used to change the chart setting, eg:
      reChart(major.ticks='months',subset='first 16 weeks')

7) To show the content of IBM, just type IBM in the prompt

No comments:

Post a Comment