lfe: Interfaces for lfe package for data science pipelines.

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Interfaces to lfe functions that can be used in a pipeline implemented by magrittr.

Usage

1

Arguments

data

data frame, tibble, list, ...

...

Other arguments passed to the corresponding interfaced function.

Details

Interfaces call their corresponding interfaced function.

Value

Object returned by interfaced function.

Author(s)

Roberto Bertolusso

See Also

lfe

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Not run: 
library(intubate)
library(magrittr)
library(lfe)

oldopts <- options(lfe.threads=1)

set.seed(123)
## create covariates
x <- rnorm(1000)
x2 <- rnorm(length(x))
## individual and firm
id <- factor(sample(20,length(x),replace=TRUE))
firm <- factor(sample(13,length(x),replace=TRUE))
## effects for them
id.eff <- rnorm(nlevels(id))
firm.eff <- rnorm(nlevels(firm))
## left hand side
u <- rnorm(length(x))
y <- x + 0.5*x2 + id.eff[id] + firm.eff[firm] + u
data <- data.frame(x = x, x2 = x2, id = id,
                   firm = firm, u = u, y = y)

## Original function to interface
est <- felm(y ~ x + x2 | id + firm, data)
summary(est)

## The interface reverses the order of data and formula
est <- ntbt_felm(data, y ~ x + x2 | id + firm)
summary(est)

## so it can be used easily in a pipeline.
data %>%
  ntbt_felm(y ~ x + x2 | id + firm) %>%
  summary()

## End(Not run)

intubate documentation built on May 2, 2019, 2:46 p.m.