R

NEW BOOK: Visualização de Dados com o R (in portuguese)

It is with great pleasure that I officially announce the publication of my book Visualização de Dados com o R. The content of the book is an extension of chapter 10 of afedR. The book is written in portuguese and available at Amazon and online: ebook paperback hardcover Online version (chapters 01-03) You can find more details in its own blog page.

Update of compiled datasets (2022)

Back in 2020 I started to compile and share financial data in dataverse. The data covers corporate finance events from the DFP and FRE systems. The available tables are the same I use for my research and teaching material, and will be updated once a year. Today I updated all datasets. The available data are: R Package Source of Data Description Direct Link Last Update GetTDData Tesouro Nacional Prices and yields of brazilian sovereign bonds Link 2022-04-06 GetFREData CVM Corporate dataset from FRE systems Link 2022-04-06 GetDFPData2 CVM Annual Financial Reports from DFP system Link 2022-04-06

New R package yfR

Package BatchGetSymbols facilitates importation of Yahoo Finance data directly into R and is one of my most popular R packages, with over 100k installations since conception (around 2500 downloads per month). However, I developed BatchGetSymbols back in 2016, with many bad structural choices from my part. For years I wanted to improved the code but always restrained myself because I did not want to mess up the execution of other people’s code that was based on BatchGetSymbols. In order to implement all the breaking changes and move forward with the package, I decided to develop a new (and fresh) package called yfR.

A shiny interface to BatchGetSymbols

Hadley Wickham recently released an online version of Mastering Shiny. The book is great! If you haven’t read it, do it fast! On a side note, it is really amazing how much of good and curated content you can get for free in R. When I started programming back in 2007, the first step was buying a brand new – and sometimes expensive – book about the language. There were blogs and other sites, but most content was very basic and not curated, meaning that the posted code most of the time did not work.

Update of compiled datasets

Back in 2020 I started to compile and share financial data in dataverse. The data covers corporate finance events from the DFP and FRE systems. The available tables are the same I use for my research and teaching material, and will be updated once a year. Today I updated all datasets. The available data are: R Package Source of Data Description Direct Link Last Update GetTDData Tesouro Nacional Prices and yields of brazilian sovereign bonds Link 2021-04-09 GetFREData CVM Corporate dataset from FRE systems Link 2021-04-09 BatchGetSymbols Yahoo Finance Daily adjusted and unadjusted prices and trading volumes of stocks Link 2021-04-09 GetDFPData2 CVM Annual Financial Reports from DFP system Link 2021-04-09

GetFREData available in CRAN!

I’m happy to report that package GetFREData is now available in CRAN. This R package serves as an interface to all corporate datasets available in the FRE system, a vast and official repository of information about many different corporate events. All companies listed at B3 – Brazilian stock exchange – must report to FRE any significant change in their corporate structure. You can find more details about what is available in FRE in its web interface. The R package fetches data from the CVM ftp, downloads and parses the xml files, and output several tables as a list.

GetDFPData2 available in CRAN!

After testing the package extensivelly, GetDFPData2 is finally available in CRAN. GetDFPData2 is the second and backwards incompatible version of GetDPFData, a R package for downloading annual financial reports from B3, the Brazilian financial exchange. Unlike its first iteration, GetDFPData2 imports data using a database of csv files from CVM, which makes it execution much faster than its predecessor. However, the output is slightly different. A shiny app – web interface – is also available at https://www.msperlin.com/shiny/GetDFPData2/. The previous version, GetDFPData, is deprecated and will not be developed any further.

A clever bash script for R Users

Back in 2017 I wrote a blog post describing a simple bash script for installing R in a Ubuntu setup. The problem with this script, and many others found in the internet, is that they quickly become obsolete due to changes in Ubuntu, R and RStudio. For example, if Ubuntu version changes from “trusty” to “focal”, the link to the CRAN ppa also changes. The same is true with RStudio, which does not provide installation by apt, only downloadable .deb files from its website. Today I manage to develop a clever bash script that uses the internet and local files to find out the current version of all software.

bookdown + exams + webex

It’s been three years since I’ve been using package bookdown for compiling and distributing three different books in Amazon and the web. It helped me greatly in all my book projects and I’m always grateful to Yihui Xie for providing such a useful tool at the right time. However, bookdown offers no support for chapter exercises of any sort. While you can write exercises in plain RMarkdown, it is not a good solution for a long term project such as a technical book. When writing the latest edition of Analyzing Financial and Economical Data with R, I aimed for a work cycle where the 100 plus exercises and their solutions were reproducible and easier to maintain.

Ten years as a professor -- six advices to young academics

In the 18th of march 2021 I’ll complete exactly ten years since finishing my PhD and taking a professorship position at UFRGS, south of Brazil. In this post I’ll write about what I learned during this period and, hopefully, help other academics that are just starting out. This post is the summary of a talk I had with a former PhD student. I’m fully aware that academic work can be very different across countries and institutions. I don’t claim to have all the answers to all the problems. But, these are a couple of advice that would certainly help me in my starting years.