Publications by Econometrics and Free Software

tidyr::spread() and dplyr::rename_at() in action

26.07.2017

I was recently confronted to a situation that required going from a long dataset to a wide dataset, but with a small twist: there were two datasets, which I had to merge into one. You might wonder what kinda crappy twist that is, right? Well, let’s take a look at the data: data1; data2 ## # A tibble: 20 x 4 ## country date varia...

1615 sym R (4638 sym/4 pcs)

tidyr::spread() and dplyr::rename_at() in action

26.07.2017

I was recently confronted to a situation that required going from a long dataset to a wide dataset, but with a small twist: there were two datasets, which I had to merge into one. You might wonder what kinda crappy twist that is, right? Well, let’s take a look at the data: data1; data2 ## # A tibble: 20 x 4 ## country date varia...

1615 sym R (4638 sym/4 pcs)

tidyr::spread() and dplyr::rename_at() in action

26.07.2017

I was recently confronted to a situation that required going from a long dataset to a wide dataset, but with a small twist: there were two datasets, which I had to merge into one. You might wonder what kinda crappy twist that is, right? Well, let’s take a look at the data: data1; data2 ## # A tibble: 20 x 4 ## country date variable_...

2384 sym

Why I find tidyeval useful

26.08.2017

First thing’s first: maybe you shouldn’t care about tidyeval. Maybe you don’t need it. If you exclusively work interactively, I don’t think that learning about tidyeval is important. I can only speak for me, and explain to you why I personally find tidyeval useful. I wanted to write this blog post after reading this twitter thread and spe...

2982 sym R (302 sym/3 pcs)

Why I find tidyeval useful

26.08.2017

First thing’s first: maybe you shouldn’t care about tidyeval. Maybe you don’t need it. If you exclusively work interactively, I don’t think that learning about tidyeval is important. I can only speak for me, and explain to you why I personally find tidyeval useful. I wanted to write this blog post after reading this twitter thread and spe...

2977 sym R (302 sym/3 pcs)

Why I find tidyeval useful

26.08.2017

First thing’s first: maybe you shouldn’t care about tidyeval. Maybe you don’t need it. If you exclusively work interactively, I don’t think that learning about tidyeval is important. I can only speak for me, and explain to you why I personally find tidyeval useful. I wanted to write this blog post after reading this twitter th...

893 sym

Easy peasy STATA-like marginal effects with R

25.10.2017

Model interpretation is essential in the social sciences. If one wants to know the effect of variable x on the dependent variable y, marginal effects are an easy way to get the answer. STATA includes a margins command that has been ported to R by Thomas J. Leeper of the London School of Economics and Political Science. You can find the source cod...

2887 sym R (3256 sym/11 pcs) 4 img

Functional peace of mind

13.11.2017

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 problems. For example, imagine for a second that R does not have the sum() functi...

2895 sym R (3436 sym/5 pcs)

Teaching the tidyverse to beginners

16.12.2017

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 some others think that one should firs...

5414 sym R (600 sym/1 pcs) 2 img

Building formulae

26.12.2017

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(m...

1381 sym R (2074 sym/5 pcs)