-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] ArgumentError: malformed expression in formula #507
Comments
I am currently using the following workaround/fix function RCall.rcopy(::Type{RCall.FormulaTerm}, l::Ptr{RCall.LangSxp})
expr = RCall.rcopy(Expr, l)
if Meta.isexpr(expr, :call) && length(expr.args) == 2 && expr.args[1] == :~
# special case of simple variable, like in aes(x, y)
return expr
end
# complex formular
return @eval RCall StatsModels.@formula($expr)
end |
I don't know if the example here is artificial, but I'm not sure I think it makes sense to try to copy the result of
If there's some cool use case I'm missing, please let me know! Then I could provide more guidance. 😄 One final "nit" -- for the example you're using here, you don't need the whole tidyverse, just ggplot2. Trimming the dependency stack can really help track down a problem, so just FYI. ❤️ |
Very impressive detailed answer. Indeed there is a usecase: I am in the process of supporting R in Pluto via RCall. Quite a special usecase, but of course in such a generic "execute some R code via RCall" setting, these cases just happen. In other words: why should |
RCall fails to handle valid R expressions
The StatsModels.@formula is apparently not meant to be used with simple variables
The text was updated successfully, but these errors were encountered: