I'm trying to call felm()
from the lfe
package inside of a function in the following way:
require(lfe)
analysis_function <- function(dataset) {
formula_for_fn <- paste0(c(reformulate(
termlabels=c('a','b','c','d'),
response=e),
' | a | 0 | a + b + c'), sep='',
collapse='')
model <- do.call("felm", list(formula=formula_for_fn,
data=dataset))
}
I am getting the following error:
Error in new.env(parent = formenv) : use of NULL environment is defunct
Can anyone help me figure out what is going wrong / how I can fix it? Thanks!