library(finreportr)
library(knitr)
library(kableExtra)

AnnualReports("GOOG")
##   filing.name filing.date         accession.no
## 1        10-K  2017-02-03 0001652044-17-000008
## 2      10-K/A  2016-03-29 0001193125-16-520367
## 3        10-K  2016-02-11 0001652044-16-000012
GOOG <- CompanyInfo("GOOG")
GOOG
##         company        CIK  SIC state state.inc FY.end
## 1 Alphabet Inc. 0001652044 7370    CA        DE   1231
##              street.address             city.state
## 1 1600 AMPHITHEATRE PARKWAY MOUNTAIN VIEW CA 94043
str(GOOG)
## 'data.frame':    1 obs. of  8 variables:
##  $ company       : chr "Alphabet Inc."
##  $ CIK           : chr "0001652044"
##  $ SIC           : chr "7370"
##  $ state         : chr "CA"
##  $ state.inc     : chr "DE"
##  $ FY.end        : chr "1231"
##  $ street.address: chr "1600 AMPHITHEATRE PARKWAY"
##  $ city.state    : chr "MOUNTAIN VIEW CA 94043"
company <- GOOG[,1]
company
## [1] "Alphabet Inc."
i <- GetIncome("GOOG", 2016)
i
##                                                                                                                                   Metric
## 1                                                                                                                               Revenues
## 2                                                                                                                               Revenues
## 3                                                                                                                               Revenues
## 4                                                                                                                        Cost of Revenue
## 5                                                                                                                        Cost of Revenue
## 6                                                                                                                        Cost of Revenue
## 7                                                                                                       Research and Development Expense
## 8                                                                                                       Research and Development Expense
## 9                                                                                                       Research and Development Expense
## 10                                                                                                         Selling and Marketing Expense
## 11                                                                                                         Selling and Marketing Expense
## 12                                                                                                         Selling and Marketing Expense
## 13                                                                                                    General and Administrative Expense
## 14                                                                                                    General and Administrative Expense
## 15                                                                                                    General and Administrative Expense
## 16                                                                                                                    Costs and Expenses
## 17                                                                                                                    Costs and Expenses
## 18                                                                                                                    Costs and Expenses
## 19                                                                                                               Operating Income (Loss)
## 20                                                                                                               Operating Income (Loss)
## 21                                                                                                               Operating Income (Loss)
## 22                                                                                                         Nonoperating Income (Expense)
## 23                                                                                                         Nonoperating Income (Expense)
## 24                                                                                                         Nonoperating Income (Expense)
## 25 Income (Loss) from Continuing Operations before Equity Method Investments, Income Taxes, Extraordinary Items, Noncontrolling Interest
## 26 Income (Loss) from Continuing Operations before Equity Method Investments, Income Taxes, Extraordinary Items, Noncontrolling Interest
## 27 Income (Loss) from Continuing Operations before Equity Method Investments, Income Taxes, Extraordinary Items, Noncontrolling Interest
## 28                                                                                                          Income Tax Expense (Benefit)
## 29                                                                                                          Income Tax Expense (Benefit)
## 30                                                                                                          Income Tax Expense (Benefit)
## 31                                                                       Income (Loss) from Continuing Operations Attributable to Parent
## 32                                                                       Income (Loss) from Continuing Operations Attributable to Parent
## 33                                                                       Income (Loss) from Continuing Operations Attributable to Parent
## 34                     Income (Loss) from Discontinued Operations, Net of Tax, Including Portion Attributable to Noncontrolling Interest
## 35                     Income (Loss) from Discontinued Operations, Net of Tax, Including Portion Attributable to Noncontrolling Interest
## 36                     Income (Loss) from Discontinued Operations, Net of Tax, Including Portion Attributable to Noncontrolling Interest
## 37                                                                                              Net Income (Loss) Attributable to Parent
## 38                                                                                              Net Income (Loss) Attributable to Parent
## 39                                                                                              Net Income (Loss) Attributable to Parent
## 40                                                                                       Preferred Stock Dividends and Other Adjustments
## 41                                                                                       Preferred Stock Dividends and Other Adjustments
## 42                                                                                       Preferred Stock Dividends and Other Adjustments
## 43                                                                             Net Income (Loss) Available to Common Stockholders, Basic
## 44                                                                             Net Income (Loss) Available to Common Stockholders, Basic
## 45                                                                             Net Income (Loss) Available to Common Stockholders, Basic
## 46                                                                             Income (Loss) from Continuing Operations, Per Basic Share
## 47                                                                             Income (Loss) from Continuing Operations, Per Basic Share
## 48                                                                                                             Earnings Per Share, Basic
## 49                                                                                                             Earnings Per Share, Basic
## 50                                                                           Income (Loss) from Continuing Operations, Per Diluted Share
## 51                                                                           Income (Loss) from Continuing Operations, Per Diluted Share
## 52                                                                                                           Earnings Per Share, Diluted
## 53                                                                                                           Earnings Per Share, Diluted
##          Units      Amount  startDate    endDate
## 1          usd 55519000000 2013-01-01 2013-12-31
## 2          usd 66001000000 2014-01-01 2014-12-31
## 3          usd 74989000000 2015-01-01 2015-12-31
## 4          usd 21993000000 2013-01-01 2013-12-31
## 5          usd 25691000000 2014-01-01 2014-12-31
## 6          usd 28164000000 2015-01-01 2015-12-31
## 7          usd  7137000000 2013-01-01 2013-12-31
## 8          usd  9832000000 2014-01-01 2014-12-31
## 9          usd 12282000000 2015-01-01 2015-12-31
## 10         usd  6554000000 2013-01-01 2013-12-31
## 11         usd  8131000000 2014-01-01 2014-12-31
## 12         usd  9047000000 2015-01-01 2015-12-31
## 13         usd  4432000000 2013-01-01 2013-12-31
## 14         usd  5851000000 2014-01-01 2014-12-31
## 15         usd  6136000000 2015-01-01 2015-12-31
## 16         usd 40116000000 2013-01-01 2013-12-31
## 17         usd 49505000000 2014-01-01 2014-12-31
## 18         usd 55629000000 2015-01-01 2015-12-31
## 19         usd 15403000000 2013-01-01 2013-12-31
## 20         usd 16496000000 2014-01-01 2014-12-31
## 21         usd 19360000000 2015-01-01 2015-12-31
## 22         usd   496000000 2013-01-01 2013-12-31
## 23         usd   763000000 2014-01-01 2014-12-31
## 24         usd   291000000 2015-01-01 2015-12-31
## 25         usd 15899000000 2013-01-01 2013-12-31
## 26         usd 17259000000 2014-01-01 2014-12-31
## 27         usd 19651000000 2015-01-01 2015-12-31
## 28         usd  2739000000 2013-01-01 2013-12-31
## 29         usd  3639000000 2014-01-01 2014-12-31
## 30         usd  3303000000 2015-01-01 2015-12-31
## 31         usd 13160000000 2013-01-01 2013-12-31
## 32         usd 13620000000 2014-01-01 2014-12-31
## 33         usd 16348000000 2015-01-01 2015-12-31
## 34         usd  -427000000 2013-01-01 2013-12-31
## 35         usd   516000000 2014-01-01 2014-12-31
## 36         usd           0 2015-01-01 2015-12-31
## 37         usd 12733000000 2013-01-01 2013-12-31
## 38         usd 14136000000 2014-01-01 2014-12-31
## 39         usd 16348000000 2015-01-01 2015-12-31
## 40         usd           0 2013-01-01 2013-12-31
## 41         usd           0 2014-01-01 2014-12-31
## 42         usd   522000000 2015-01-01 2015-12-31
## 43         usd 12733000000 2013-01-01 2013-12-31
## 44         usd 14136000000 2014-01-01 2014-12-31
## 45         usd 15826000000 2015-01-01 2015-12-31
## 46 usdPerShare       19.77 2013-01-01 2013-12-31
## 47 usdPerShare       20.15 2014-01-01 2014-12-31
## 48 usdPerShare       19.13 2013-01-01 2013-12-31
## 49 usdPerShare       20.91 2014-01-01 2014-12-31
## 50 usdPerShare       19.42 2013-01-01 2013-12-31
## 51 usdPerShare       19.82 2014-01-01 2014-12-31
## 52 usdPerShare       18.79 2013-01-01 2013-12-31
## 53 usdPerShare       20.57 2014-01-01 2014-12-31
str(i)
## 'data.frame':    53 obs. of  5 variables:
##  $ Metric   : chr  "Revenues" "Revenues" "Revenues" "Cost of Revenue" ...
##  $ Units    : chr  "usd" "usd" "usd" "usd" ...
##  $ Amount   : chr  "55519000000" "66001000000" "74989000000" "21993000000" ...
##  $ startDate: chr  "2013-01-01" "2014-01-01" "2015-01-01" "2013-01-01" ...
##  $ endDate  : chr  "2013-12-31" "2014-12-31" "2015-12-31" "2013-12-31" ...
income <- as.numeric(i[1,3])
str(income)
##  num 5.55e+10
kable(i, "html", caption = "Income Statement") %>%
   kable_styling(bootstrap_options = "striped", full_width = T)
Income Statement
Metric Units Amount startDate endDate
Revenues usd 55519000000 2013-01-01 2013-12-31
Revenues usd 66001000000 2014-01-01 2014-12-31
Revenues usd 74989000000 2015-01-01 2015-12-31
Cost of Revenue usd 21993000000 2013-01-01 2013-12-31
Cost of Revenue usd 25691000000 2014-01-01 2014-12-31
Cost of Revenue usd 28164000000 2015-01-01 2015-12-31
Research and Development Expense usd 7137000000 2013-01-01 2013-12-31
Research and Development Expense usd 9832000000 2014-01-01 2014-12-31
Research and Development Expense usd 12282000000 2015-01-01 2015-12-31
Selling and Marketing Expense usd 6554000000 2013-01-01 2013-12-31
Selling and Marketing Expense usd 8131000000 2014-01-01 2014-12-31
Selling and Marketing Expense usd 9047000000 2015-01-01 2015-12-31
General and Administrative Expense usd 4432000000 2013-01-01 2013-12-31
General and Administrative Expense usd 5851000000 2014-01-01 2014-12-31
General and Administrative Expense usd 6136000000 2015-01-01 2015-12-31
Costs and Expenses usd 40116000000 2013-01-01 2013-12-31
Costs and Expenses usd 49505000000 2014-01-01 2014-12-31
Costs and Expenses usd 55629000000 2015-01-01 2015-12-31
Operating Income (Loss) usd 15403000000 2013-01-01 2013-12-31
Operating Income (Loss) usd 16496000000 2014-01-01 2014-12-31
Operating Income (Loss) usd 19360000000 2015-01-01 2015-12-31
Nonoperating Income (Expense) usd 496000000 2013-01-01 2013-12-31
Nonoperating Income (Expense) usd 763000000 2014-01-01 2014-12-31
Nonoperating Income (Expense) usd 291000000 2015-01-01 2015-12-31
Income (Loss) from Continuing Operations before Equity Method Investments, Income Taxes, Extraordinary Items, Noncontrolling Interest usd 15899000000 2013-01-01 2013-12-31
Income (Loss) from Continuing Operations before Equity Method Investments, Income Taxes, Extraordinary Items, Noncontrolling Interest usd 17259000000 2014-01-01 2014-12-31
Income (Loss) from Continuing Operations before Equity Method Investments, Income Taxes, Extraordinary Items, Noncontrolling Interest usd 19651000000 2015-01-01 2015-12-31
Income Tax Expense (Benefit) usd 2739000000 2013-01-01 2013-12-31
Income Tax Expense (Benefit) usd 3639000000 2014-01-01 2014-12-31
Income Tax Expense (Benefit) usd 3303000000 2015-01-01 2015-12-31
Income (Loss) from Continuing Operations Attributable to Parent usd 13160000000 2013-01-01 2013-12-31
Income (Loss) from Continuing Operations Attributable to Parent usd 13620000000 2014-01-01 2014-12-31
Income (Loss) from Continuing Operations Attributable to Parent usd 16348000000 2015-01-01 2015-12-31
Income (Loss) from Discontinued Operations, Net of Tax, Including Portion Attributable to Noncontrolling Interest usd -427000000 2013-01-01 2013-12-31
Income (Loss) from Discontinued Operations, Net of Tax, Including Portion Attributable to Noncontrolling Interest usd 516000000 2014-01-01 2014-12-31
Income (Loss) from Discontinued Operations, Net of Tax, Including Portion Attributable to Noncontrolling Interest usd 0 2015-01-01 2015-12-31
Net Income (Loss) Attributable to Parent usd 12733000000 2013-01-01 2013-12-31
Net Income (Loss) Attributable to Parent usd 14136000000 2014-01-01 2014-12-31
Net Income (Loss) Attributable to Parent usd 16348000000 2015-01-01 2015-12-31
Preferred Stock Dividends and Other Adjustments usd 0 2013-01-01 2013-12-31
Preferred Stock Dividends and Other Adjustments usd 0 2014-01-01 2014-12-31
Preferred Stock Dividends and Other Adjustments usd 522000000 2015-01-01 2015-12-31
Net Income (Loss) Available to Common Stockholders, Basic usd 12733000000 2013-01-01 2013-12-31
Net Income (Loss) Available to Common Stockholders, Basic usd 14136000000 2014-01-01 2014-12-31
Net Income (Loss) Available to Common Stockholders, Basic usd 15826000000 2015-01-01 2015-12-31
Income (Loss) from Continuing Operations, Per Basic Share usdPerShare 19.77 2013-01-01 2013-12-31
Income (Loss) from Continuing Operations, Per Basic Share usdPerShare 20.15 2014-01-01 2014-12-31
Earnings Per Share, Basic usdPerShare 19.13 2013-01-01 2013-12-31
Earnings Per Share, Basic usdPerShare 20.91 2014-01-01 2014-12-31
Income (Loss) from Continuing Operations, Per Diluted Share usdPerShare 19.42 2013-01-01 2013-12-31
Income (Loss) from Continuing Operations, Per Diluted Share usdPerShare 19.82 2014-01-01 2014-12-31
Earnings Per Share, Diluted usdPerShare 18.79 2013-01-01 2013-12-31
Earnings Per Share, Diluted usdPerShare 20.57 2014-01-01 2014-12-31