bergant / xbrlfiles Goto Github PK
View Code? Open in Web Editor NEWExplore XBRL with R
Explore XBRL with R
I've posted a problem on stackoverflow. There are two fundamental issues:
Hoping you could take a look and offer any thoughts.
Thanks
From both RStudio and console R version 3.3.0 (2016-05-03) I am getting an IO error from the high and low level XBRL library commands that ends up locking my R session.
Code used is the example code from the CRAN pdf, and tested with multiple different xbrl xml files on SEC site as well as stored locally.
The level 1 function, xbrlDoAll, fails straight away with an IO error and then R hangs.
The level 2 functions work until you get to xbrl$openInstance(inst), which throws the I/O error.
If you continue to then ecexute xbrl$processSchema(xbrl$getSchemaName()) you will hang R - possibly what is happening when calling the level 1 function.
The level 3 function xbrlParse(inst) throws the same IO error. For convenience here is the example code:
## Setting stringsAsFactors = FALSE is highly recommended
## to avoid data frames to create factors from character vectors.
options(stringsAsFactors = FALSE)
## Load the library
library(XBRL)
## XBRL instance file to be analyzed, accessed
## directly from SEC website:
inst <- "http://www.sec.gov/Archives/edgar/data/21344/000002134413000050/ko-20130927.xml"
## Level 1: Function that does all work and returns
## a list of data frames with extracted information:
## Not run:
xbrl.vars <- xbrlDoAll(inst, verbose=TRUE)
## Level 2: Using the XBRL() "mutable state" function:
xbrl <- XBRL()
xbrl$setCacheDir("XBRLcache")
xbrl$openInstance(inst)
## Perform a discovery of the taxonomy:
xbrl$processSchema(xbrl$getSchemaName())
## Process instance file:
xbrl$processContexts()
xbrl$processUnits()
xbrl$processFacts()
xbrl$processFootnotes()
xbrl$closeInstance()
xbrl.vars <- xbrl$getResults()
inst <- "~/R/StockTickers/XBRLdocs/ph-20160331.xml"
xbrl$setCacheDir("~/R/StockTickers/XBRLdocs")
## End(Not run)
## Level 3: Using specialized functions that call C++ code directly:
## Parse the instance (doc is an pointer to external memory that needs to be freed):
doc <- xbrlParse(inst)
## Get a data frame with facts:
fct <- xbrlProcessFacts(doc)
## Get a data frame with contexts:
cts <- xbrlProcessContexts(doc)
## Get a data frame with units:
unt <- xbrlProcessUnits(doc)
## Free the external memory used:
xbrlFree(doc)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.