On 01/09/2017 7:37 PM, Yingrui Liu wrote:
Dear Sir/Madam,
How to use getSymbols() to get annual data? For example, I need the annual
stock price of APPLE from the year 2000 to 2016. How to write the command? I
only know how to get the daily data. It is:
getSymbols("AAPL",from="2000-01-01",to="2016-12-31")
Presumably you'd need to loop over the years: get all the daily data in
a year, calculate the overall High and Low, take the Open from the first
date, the Close from the last one, and repeat.
Duncan Murdoch
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.