Is there way I can extract the data for last 10 historic periods? As of now I am getting 5 historic quarterly reports and 4 historic Annual reports via this code.
Please help me.
library(quantmod)
getFin('AAPL') # returns AAPL.f to "env"
viewFin(AAPL.f, "IS", "Q") # Quarterly Income Statement
viewFin(AAPL.f, "CF", "A") # Annual Cash Flows
BTW, if you want 10 years worth of metrics and ratios, you can use this methodology.
read.csv("http://financials.morningstar.com/ajax/exportKR2CSV.html?&t=AAPL",header=T,stringsAsFactors = F,skip = 2)[,-c(12)]->spreadsheet
#str(spreadsheet)
View(spreadsheet)