This code (correctly) will not plot because one of the values of x2 is Inf which does not work with xlim (plot.window(...) : need finite 'xlim' values).
This comes up for me when creating a event-study dummies (E.g. never_treated has year_treated = Inf; rel_year = year - year_treated = -Inf).
I'm raising this as an issue b/c I don't know what the best fix would be on fixest's end.
Two user-land fixes could be:
manually change the value from -Inf to -100 or something, but this would make the figure look weird. So, user would have to chose like min - 1 or something which is a pain.
Use drop = "Inf". This is probably the best answer, but the docs do not mention for iplot the values not the normal x2::Inf" regex. As an aside, could we add the error note to the documentation? "Note that in iplot, the variables names are the values that should be in the x-axis."
library(fixest)
data <- data.frame(x1 = runif(100), x2 = sample(c(1, 2, Inf), 100, replace = TRUE))
data$y <- data$x1 * 2 + rnorm(100)
est = feols(y ~ x1 + i(x2, ref = Inf), data = data)
iplot(est)
#> Error in plot.window(...): need finite 'xlim' values
This code (correctly) will not plot because one of the values of x2 is
Inf
which does not work with xlim (plot.window(...) : need finite 'xlim' values
).This comes up for me when creating a event-study dummies (E.g. never_treated has year_treated = Inf; rel_year = year - year_treated = -Inf).
I'm raising this as an issue b/c I don't know what the best fix would be on
fixest
's end.Two user-land fixes could be:
min - 1
or something which is a pain.drop = "Inf"
. This is probably the best answer, but the docs do not mention foriplot
the values not the normalx2::Inf"
regex. As an aside, could we add the error note to the documentation? "Note that iniplot
, the variables names are the values that should be in the x-axis."