Articles by Econometrics and Free Software

Building formulae

December 26, 2017 | Econometrics and Free Software

This Stackoverflow question made me think about how to build formulae. For example, you might want to programmatically build linear model formulae and then map these models on data. For example, suppose the following (output suppressed):
data(mtcars)

lm(mpg ~ hp, data = mtcars)
lm(mpg ~I(hp^2), data = mtcars)
lm(mpg ~I(hp^3), data = mtcars)
lm(mpg ~I(hp^4), data = mtcars)
lm(mpg ~I(hp^5), data = mtcars)
lm(mpg ~I(hp^6), data = mtcars)
To avoid doing this, one can write a function that builds the formulae: {{... [Read more...]

Teaching the tidyverse to beginners

December 16, 2017 | Econometrics and Free Software

End October I tweeted this: will teach #rstats soon again but this time following @drob 's suggestion of the tidyverse first as laid out here: https://t.co/js8SsUs8Nv— Bruno Rodrigues (@brodriguesco) October 24, 2017 and it generated some discussion. Some people believe that this is the right approach, and ... [Read more...]

Functional peace of mind

November 13, 2017 | Econometrics and Free Software

I think what I enjoy the most about functional programming is the peace of mind that comes with it. With functional programming, there’s a lot of stuff you don’t need to think about. You can write functions that are general enough so that they solve a variety of ... [Read more...]

Make ggplot2 purrr

March 28, 2017 | Econometrics and Free Software

I’ll be honest: the title is a bit misleading. I will not use purrr that much in this blog post. Actually, I will use one single purrr function, at the very end. I use dplyr much more. However Make ggplot2 purrr sounds better than Make ggplot dplyr or whatever ... [Read more...]

Make ggplot2 purrr

March 28, 2017 | Econometrics and Free Software

Update: I’ve included another way of saving a separate plot by group in this article, as pointed out by @monitus. Actually, this is the preferred solution; using dplyr::do() is deprecated, according to Hadley Wickham himself. I’ll be honest: the title is a bit misleading. I will not ... [Read more...]

Introducing brotools

March 27, 2017 | Econometrics and Free Software

I’m happy to announce my first R package, called brotools. This is a package that contains functions that are specific to my needs but that you might find also useful. I blogged about some of these functions, so if you follow my blog you might already be familiar with ... [Read more...]

Introducing brotools

March 27, 2017 | Econometrics and Free Software

I’m happy to announce my first R package, called brotools. This is a package that contains functions that are specific to my needs but that you might find also useful. I blogged about some of these functions, so if you follow my blog you might already be familiar with ... [Read more...]

Lesser known purrr tricks

March 24, 2017 | Econometrics and Free Software

purrr is package that extends R’s functional programming capabilities. It brings a lot of new stuff to the table and in this post I show you some of the most useful (at least to me) functions included in purrr. Getting rid of loops with map()
library(purrr)

numbers <- list(11, 12, 13, 14)

map_dbl(numbers, sqrt)
## [1] 3.316625 3.464102 3.605551 3.741657
You might ... [Read more...]

Lesser known purrr tricks

March 24, 2017 | Econometrics and Free Software

purrr is a package that extends R’s functional programming capabilities. It brings a lot of new stuff to the table and in this post I show you some of the most useful (at least to me) functions included in purrr. Getting rid of loops with map()
library(purrr)

numbers <- list(11, 12, 13, 14)

map_dbl(numbers, sqrt)
## [1] 3.316625 3.464102 3.605551 3.741657
You ... [Read more...]
1 7 8 9 10

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)