I noticed that using ^ can cause issues with formula parsing. Here's the case I tripped over, with stats::terms.formula called indirectly by fixest::r2. I think this is a bug, though let me know if I'm misinterpreting.
library(fixest)
gravity_results <- feglm(
Euros ~ log(dist_km) | Origin ^ Destination + Product ^ Year,
data=trade
)
r2(gravity_results)
#> Error in terms.formula(tmp, simplify = TRUE): invalid power in formula
Created on 2019-11-22 by the reprex package (v0.3.0)