finstr-package: finstr: financial statements in R
Description
finstr provides data structures and functions for financial statement data
manipulationFinancial Statements
Financial statements data contain many variables (concepts, elements).
Several concepts are aggregations of other concepts.
Specific aggregations are needed for each purpose of
financial statement analysis. Package finstr provides the necessary data structures and functions to
manipulate financial statements data in R.Getting Data to Statement Structure
-
Convert XBRL (XML files and schemas) to a list of data frames
(facts, contexts, roles and hierarchies) with xbrlDoAll
function from XBRL-package.
-
Function
xbrl_get_statements
converts the XBRL data list
to statements object. It is a list of
several statement objects (ballance sheets, income and cash
flow statements) which are data frames with elements as columns and periods
as rows.
-
Information about calculation hierarchy of concepts and their descriptions
is stored as an attribute to the statement object
and can be retrieved by
get_elements
.
Using Financial Statements Data
-
Function
merge.statement
can merge statements from different
periods to a single statement object. The elements and hierarchies are merged to
provide comfortable analysis of data over several periods.
- To calculate values with formulas
use
calculate
function or use
statement as a data frame with R base functions and packages
like dplyr for manipulating data
frames.
For real data examples see vignettes: browseVignettes("finstr")
References
http://en.wikipedia.org/wiki/Financial_statement http://www.xbrl.org