O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

There's more...

R provides an easy way of pulling near-real-time stock data directly through API using the quantmod package:

 install.packages("quantmod") library("quantmod")

With the quantmod package, it is really easy to pull historical data from Yahoo or Google finance with a single line of code:

getSymbols('AMZN')

Besides pulling historical stock data, quantmod also provides various visualization functions for exploring the data. The following command creates a bar chart and chart series for the Amazon stocks:

barChart(AMZN)
chartSeries(AMZN, TA="NULL")

Here, TA="Null" indicates not to use any technical indicator. 

This package also provides ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required