-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
Hello Laurent, I have to use use_calling_env in the example below but it throws a warning because this argument is passed to feols() (or another estimation function). I'm preparing a PR for this, this issue is just to have a trace of this bug.
library(fixest)
f1 <- feols(mpg ~ hp | am + cyl, data = mtcars)
### This doesn't work -> need to use `use_calling_env = FALSE`
foo1 <- function(x) {
mtcars2 <- mtcars
mtcars2[mtcars2$cyl < 6, "hp"] <- 1
update(f1, data = mtcars2)
}
foo1(f1)
#> Error in feols(fml = mpg ~ hp | am + cyl, data = mtcars2): Argument 'data' could not be evaluated.
#> PROBLEM: object 'mtcars2' not found.
foo2 <- function(x) {
mtcars2 <- mtcars
mtcars2[mtcars2$cyl < 6, "hp"] <- 1
update(f1, data = mtcars2, use_calling_env = FALSE)
}
foo2(f1)
#> Warning: In fixest_env(fml = fml, data = data, weights = weig...:
#> feols(fml = mpg...: use_calling_env is not a valid argument for function
#> feols()
#> OLS estimation, Dep. Var.: mpg
#> Observations: 32
#> Fixed-effects: am: 2, cyl: 3
#> Standard-errors: IID
#> Estimate Std. Error t value Pr(>|t|)
#> hp -0.035276 0.016895 -2.088 0.046362 *
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> RMSE: 2.66766 Adj. R2: 0.767806
#> Within R2: 0.139024Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels