r - Getting specific line from Cash Flow -
i'm trying data cash flow getfinancials function in r.
library(quantmod) s <- c("aapl","goog","ibm","gs","amzn","ge") fin <- lapply(s, getfinancials, auto.assign=false) names(fin) <- s
but when try specific line with
fin$aapl$cf$a["cash operating activities"] fin$aapl$cf$a["capital expenditures"]
i na return. how can these specific lines cash flow?
since fin$aapl$cf$a
matrix, need comma after name because asking row name. without comma asking vector element named "cash operating activities", , since have matrix individual elements not named.
class(fin$aapl$cf$a) # [1] "matrix" "cash operating activities" %in% rownames(fin$aapl$cf$a) # [1] true ## no comma - na because "cash operating activities" not named vector element fin$aapl$cf$a["cash operating activities"] # [1] na
this can more illustrated with
x <- 1 x["x"] # [1] na
since x
has no named element "x"
, na. want following.
## comma - asking row "cash operating activities" fin$aapl$cf$a["cash operating activities", ] # 2014-09-27 2013-09-28 2012-09-29 2011-09-24 # 59713 53666 50856 37529
since these matrices, rows requested on left side of comma, columns on right, , single named elements no comma.
Comments
Post a Comment