I am working on analyzing Balance Sheets using R. I am using Quantmod for the same. Now I want to compare two individual rows in a balance sheet, say Cash and Equivalents and Accounts Receivable.
How do I refer these using Quantmod.
viewFin(AAPL.f,type="BS",period="A")
The above line displays the balance sheet. But how do I refer to individual rows.
Thanks in advance.
viewFin
returns a list object, you can use rownames
of the corresponding balance sheet object to subset your columns of interest
library("quantmod")
getFin('AAPL')
str(AAPL.f)
#List of 3
#.
#.
#.
#viewFin(AAPL.f,type="BS",period="A")
DF = AAPL.f$BS$A #equivalent to above step
balanceSheet_Items = rownames(DF)
itemsOfInterest = c("Cash & Equivalents","Accounts Receivable - Trade, Net")
subsetDF = DF[balanceSheet_Items %in% itemsOfInterest,]
subsetDF
# 2016-09-24 2015-09-26 2014-09-27
#Cash & Equivalents 11883 9731 3612
#Accounts Receivable - Trade, Net 15754 16849 17460
# 2013-09-28
#Cash & Equivalents 5554
#Accounts Receivable - Trade, Net 13102