Package GetITRData. October 22, 2017

Similar documents
Package GetHFData. November 28, 2017

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package fastdummies. January 8, 2018

Package ECctmc. May 1, 2018

Package gtrendsr. October 19, 2017

Package validara. October 19, 2017

Package robotstxt. November 12, 2017

Package fitbitscraper

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package ecoseries. R topics documented: September 27, 2017

Package postal. July 27, 2018

Package rgho. R topics documented: January 18, 2017

Package oec. R topics documented: May 11, Type Package

Package gtrendsr. August 4, 2018

Package editdata. October 7, 2017

Package barcoder. October 26, 2018

Package jpmesh. December 4, 2017

Package statsdk. September 30, 2017

Package fastqcr. April 11, 2017

Package ggimage. R topics documented: November 1, Title Use Image in 'ggplot2' Version 0.0.7

Package qualmap. R topics documented: September 12, Type Package

Package bisect. April 16, 2018

Package splithalf. March 17, 2018

Package gggenes. R topics documented: November 7, Title Draw Gene Arrow Maps in 'ggplot2' Version 0.3.2

Package datasets.load

Package rnaturalearth

Package TrafficBDE. March 1, 2018

Package opencage. January 16, 2018

Package SEMrushR. November 3, 2018

Package reval. May 26, 2015

Package ggseas. June 12, 2018

Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package essurvey. August 23, 2018

Package strat. November 23, 2016

Package censusapi. August 19, 2018

Package internetarchive

Package kirby21.base

Package canvasxpress

Package mdftracks. February 6, 2017

Package calpassapi. August 25, 2018

Package IsoCorrectoR. R topics documented:

Package jstree. October 24, 2017

Package rcv. August 11, 2017

Package WordR. September 7, 2017

Package readxl. April 18, 2017

Package lumberjack. R topics documented: July 20, 2018

Package cregulome. September 13, 2018

Package facerec. May 14, 2018

Package pdfsearch. July 10, 2018

Package preprosim. July 26, 2016

Package datapasta. January 24, 2018

Package vinereg. August 10, 2018

Package pdfetch. October 15, 2017

Package librarian. R topics documented:

Package postgistools

Package kdtools. April 26, 2018

Package edfreader. R topics documented: May 21, 2017

Package ezknitr. September 16, 2016

Package githubinstall

Package dkanr. July 12, 2018

Package clipr. June 23, 2018

Package censusr. R topics documented: June 14, Type Package Title Collect Data from the Census API Version 0.0.

Package RODBCext. July 31, 2017

Package wikitaxa. December 21, 2017

Package available. November 17, 2017

Package fingertipsr. May 25, Type Package Version Title Fingertips Data for Public Health

Package knitrprogressbar

Package svalues. July 15, 2018

Package condusco. November 8, 2017

Package catenary. May 4, 2018

Package effectr. January 17, 2018

Package tidytransit. March 4, 2019

Package rzeit2. January 7, 2019

Package rbgm. May 18, 2018

Package messaging. May 27, 2018

Package RndTexExams. R topics documented:

Package smapr. October 20, 2017

Package rprojroot. January 3, Title Finding Files in Project Subdirectories Version 1.3-2

Package data.world. April 5, 2018

R topics documented: 2 checkpoint-package

Package docxtools. July 6, 2018

Package goodpractice

Package BANEScarparkinglite

Package keyholder. May 19, 2018

Package virustotal. May 1, 2017

Package raker. October 10, 2017

Package balance. October 12, 2018

Package BiocManager. November 13, 2018

Package guardianapi. February 3, 2019

Package geneslope. October 26, 2016

Package rtext. January 23, 2019

Package modules. July 22, 2017

Package shinyfeedback

Package repec. August 31, 2018

Package nngeo. September 29, 2018

Package widyr. August 14, 2017

Package rsppfp. November 20, 2018

Package phrasemachine

Package bikedata. April 27, 2018

Package ezsummary. August 29, 2016

Transcription:

Package GetITRData October 22, 2017 Title Reading Financial Reports from Bovespa's ITR System Version 0.6 Date 2017-10-21 Reads quarterly and annual financial reports including assets, liabilities, income and cash flow statements from Bovespa's ITR (informacoes trimestrais) system <http://www.bmfbovespa.com.br/en_us/products/listed-equities-andderivatives/equities/listed-companies.htm>. The ITR/DFP system is a web based interface for all financial reports of companies traded at Bovespa. The package is especially designed for large scale data importation, keeping a tabular (long) structure for easier processing. Depends R (>= 3.3.0) Imports stringr,xml,dplyr, readr, reshape2, tibble, xlsx, stats, curl, BETS License GPL-2 BugReports https://github.com/msperlin/getitrdata/issues URL https://github.com/msperlin/getitrdata/ LazyData true RoxygenNote 6.0.1 Suggests knitr, rmarkdown, testthat, ggplot2 VignetteBuilder knitr NeedsCompilation no Author Marcelo Perlin [aut, cre] Maintainer Marcelo Perlin <marceloperlin@gmail.com> Repository CRAN Date/Publication 2017-10-22 14:15:28 UTC 1

2 gitrd.convert.to.wide R topics documented: gitrd.convert.to.wide.................................... 2 gitrd.export.itr.data.................................... 3 gitrd.fix.dataframes..................................... 3 gitrd.get.bovespa.data.................................... 4 gitrd.get.info.companies.................................. 5 gitrd.getitrdata...................................... 6 gitrd.read.fwf.file...................................... 7 gitrd.read.zip.file...................................... 8 gitrd.read.zip.file.type.1................................... 8 gitrd.read.zip.file.type.2................................... 9 gitrd.search.company.................................... 10 Index 11 gitrd.convert.to.wide Converts a dataframe from gitr_getitrdata to the wide format Converts a dataframe from gitr_getitrdata to the wide format gitrd.convert.to.wide(data.in, data.in.cols = "original") data.in data.in.cols Data frame with financial information Which data to go in rows values ( original or inflation adjusted ) A dataframe in the wide format # get example data from RData file my.f <- system.file('extdata/examplereport_petrobras.rdata', package = 'GetITRData') load(my.f) df.assets <- df.reports$fr.assets[[1]] df.assets.wide <- gitrd.convert.to.wide(df.assets)

gitrd.export.itr.data 3 gitrd.export.itr.data Export tibble to an excel file Export tibble to an excel file gitrd.export.itr.data(data.in, base.file.name = paste0("getitrdata_export_", Sys.Date()), type.export = "xlsx", format.data = "wide") data.in Tibble with financial information (output of gitrd.getitrdata) base.file.name The basename of excel file (don t include extension) type.export format.data nothing The extension of the desired format (only xlsx implemented so far) The format of output. wide (default) for a wide table and long for a long table # get example data from RData file my.f <- system.file('extdata/examplereport_petrobras.rdata', package = 'GetITRData') load(my.f) ## Not run: # dontrun: keep cran check time short gitrd.export.itr.data(df.reports, base.file.name = 'MyExcelFile', format.data = 'wide') ## End(Not run) gitrd.fix.dataframes Fix dataframe for version issues and inflation measures (internal) Fix dataframe for version issues and inflation measures (internal) gitrd.fix.dataframes(df.in, inflation.index, df.inflation, max.levels = 3)

4 gitrd.get.bovespa.data df.in A dataframe with financial statements inflation.index Sets the inflation index to use for finding inflation adjusted values of all reports. Possible values: dollar (default) or IPCA, the brazilian main inflation index. When using IPCA, the base date is set as the last date found in the inflation dataset. df.inflation max.levels The fixed data.frame Dataframe with inflation data Sets the maximum number of levels of accounting items in financial reports #' # get example data from RData file my.f <- system.file('extdata/examplereport_petrobras.rdata', package = 'GetITRData') load(my.f) df.assets <- df.reports$fr.assets[[1]] df.assets.fixed <- gitrd.fix.dataframes(df.assets, inflation.index = 'none', df.inflation = data.frame()) gitrd.get.bovespa.data Reads information for a company from B3 site Given a CVM code, this function scrapes information from the company page. gitrd.get.bovespa.data(my.id) my.id A CVM id A list with several dataframes

gitrd.get.info.companies 5 ## Not run: # keep cran check fast l.info.petr <- gitrd.get.dovespa.data(my.id = 9512) str(l.info.petr) ## End(Not run) gitrd.get.info.companies Reads up to date information about Bovespa companies from a github file A csv file with information about available companies and time periods is downloaded from github and read. This file is updated periodically and manually by the author. When run for the first time in a R session, a.rdata file containing the output of the function is saved in tempdir() for caching. gitrd.get.info.companies(type.data = "companies_files") type.data A string that sets the type of information to be returned ( companies or companies_files ). If companies, it will return a dataframe with several information about companies, but without download links. A dataframe with several information about Bovespa companies ## Not run: # keep cran check fast df.info <- gitrd.get.info.companies() str(df.info) ## End(Not run)

6 gitrd.getitrdata gitrd.getitrdata Downloads and reads financial reports from Bovespa Quarterly and annual financial reports are downloaded from B3 for a combination of companies and time period. The easist way to get started with gitrd.getitrdata is looking for the official name of traded companies using function gitrd.search.company( nametolookfor ). Alternatively, you can use function gitrd.get.info.companies( companies ) to import a dataframe with information for all available companies and time periods. gitrd.getitrdata(name.companies, first.date = Sys.Date() - 12 * 30, last.date = Sys.Date(), type.info = "individual", periodicy.fin.report = "annual", inflation.index = "dollar", max.levels = 3, folder.out = tempdir(), be.quiet = FALSE) name.companies Official names of companies to get financial reports (e.g. ELETROPAULO METROPOLITANA EL.S.PAULO S.A ). Names of companies can be found using function gitrd.search.company( nametolookfor ) or gitrd.get.info.companies( companies ) first.date First date (YYYY-MM-DD) to get data. Character or Date. E.g. first.date = 2010-01-01. last.date Last date (YYYY-MM-DD) to get data. Character or Date. E.g. last.date = 2017-01-01. type.info Type of financial statements, individual (default) or consolidated. Argument can be a single value or a vector with the same length as name.companies. The individual type only includes financial statements from the company itself, while consolidated statements adds information about controlled companies periodicy.fin.report The frequency of financial reports: annual (default) or quarterly inflation.index Sets the inflation index to use for finding inflation adjusted values of all reports. Possible values: dollar (default) or IPCA, the brazilian main inflation index. When using IPCA, the base date is set as the last date found in the inflation dataset. max.levels folder.out Sets the maximum number of levels of accounting items in financial reports Folder where to download and manipulate the zip files. Default = tempdir() be.quiet Should the function output information about progress? TRUE (default) or FALSE

gitrd.read.fwf.file 7 A tibble (dataframe with lists) object with all gathered financial statements, with each company as a row in the tibble. ## Not run: #dontrun: keep cran check time short name.companies <- 'ELETROPAULO METROPOLITANA EL.S.PAULO S.A' first.date <- '2005-01-01' last.date <- '2006-01-01' df.statements <- gitrd.getitrdata(name.companies = name.companies, first.date = first.date, last.date = last.date) ## End(Not run) gitrd.read.fwf.file Reads FWF file from bovespa (internal) Reads FWF file from bovespa (internal) gitrd.read.fwf.file(my.f, type.fin.report) my.f File to be read type.fin.report Peridodicy of fin data ( itr - quarterly or dfp - annual) A dataframe with data my.f <- system.file('extdata/itrbpae.001', package = 'GetITRData') df.assets <- gitrd.read.fwf.file(my.f, type.fin.report = 'itr')

8 gitrd.read.zip.file.type.1 gitrd.read.zip.file Reads a single zip file downloaded from Bovespa Reads a single zip file downloaded from Bovespa gitrd.read.zip.file(my.zip.file, folder.to.unzip = tempdir(), id.type, type.fin.report) my.zip.file Full path to zip file folder.to.unzip Folder to unzip files (default = tempdir()) id.type The type of file structure ( after 2011 or before 2011 ) type.fin.report Peridodicy of fin data ( itr - quarterly or dfp - annual) A list with several dataframes containing financial statements my.f <- system.file('extdata/434_arac_2008-09-30.zip', package = 'GetITRData') my.l <- gitrd.read.zip.file(my.f, id.type = 'before 2011', type.fin.report = 'itr') print(my.l) gitrd.read.zip.file.type.1 Reads folder for zip file post 2011 (internal) Reads folder for zip file post 2011 (internal) gitrd.read.zip.file.type.1(rnd.folder.name, folder.to.unzip = tempdir(), type.fin.report)

gitrd.read.zip.file.type.2 9 rnd.folder.name Folder where unzipped files are available folder.to.unzip Folder to unzip files (default = tempdir()) type.fin.report Peridodicy of fin data ( itr - quarterly or dfp - annual) A list with financial statements # no example (this functions not used directly) gitrd.read.zip.file.type.2 Reads folder for zip file pre 2011 (internal) Reads folder for zip file pre 2011 (internal) gitrd.read.zip.file.type.2(rnd.folder.name, folder.to.unzip = tempdir(), type.fin.report) rnd.folder.name Folder where unzipped files are available folder.to.unzip Folder to unzip files (default = tempdir()) type.fin.report Peridodicy of fin data ( itr - quarterly or dfp - annual) A list with financial statements # no example (this functions not used directly)

10 gitrd.search.company gitrd.search.company Helps users search for a company name Helps users search for a company name gitrd.search.company(char.to.search) char.to.search Character for partial matching Names of found companies ## Not run: # dontrun: keep cran check fast gitrd.search.company('gerdau') ## End(Not run)

Index gitrd.convert.to.wide, 2 gitrd.export.itr.data, 3 gitrd.fix.dataframes, 3 gitrd.get.bovespa.data, 4 gitrd.get.info.companies, 5 gitrd.getitrdata, 6 gitrd.read.fwf.file, 7 gitrd.read.zip.file, 8 gitrd.read.zip.file.type.1, 8 gitrd.read.zip.file.type.2, 9 gitrd.search.company, 10 11