I downloaded annual earnings by Google over past 4 years:
library(quantmod)
getFinancials(GOOG)
df<-viewFinancials(GOOG.f, type='IS', period='A',subset = NULL)['Net Income',]
df<-(as.data.frame(df))
Here is how the data is displayed:
2015-12-31 16348
2014-12-31 14136
2013-12-31 12733
2012-12-31 10737
I would like to "extrapolate" this data as an averaged linear growth over next 10 years, something in this fashion:
In Excel, all I need to paste the above data, sort from oldest to newest, select it, and "stretch" the selection over 10 additional rows, with this result:
12/31/2012 10737
12/31/2013 12733
12/31/2014 14136
12/31/2015 16348
12/31/2016 18048
12/31/2017 19871
12/31/2018 21695
12/31/2019 23518
12/31/2020 25342
12/31/2021 27166
12/31/2022 28989
12/31/2023 30813
12/31/2024 32636
12/31/2025 34460
How can I do the same (or something close to it) in R?