Skip to content
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

Issues with @rput #68

Closed
Reulguen opened this issue Nov 2, 2023 · 4 comments · Fixed by #71
Closed

Issues with @rput #68

Reulguen opened this issue Nov 2, 2023 · 4 comments · Fixed by #71

Comments

@Reulguen
Copy link

Reulguen commented Nov 2, 2023

Hi,

I have been running my statistical model the first time in Julia and want to save my model in order to load it into R for further plotting etc. However, I have issues when it comes to use @rput.

This is my code:

fit_uV =  @formula uV ~ (saggitality + laterality + condition + mention + bepoch) +
                                    (1 + condition + mention | subj) +
                                    (1 + mention | Report / text);

model_lme4 = fit(MixedModel, fit_uV, data)

model_for_r = (model_lme4, data);
@rput model_for_r

and this is the error message that I receive:

julia> @rput model_for_r
ERROR: type InteractionTerm has no field sym
Stacktrace:
 [1] convert_julia_to_r(f::StatsModels.FormulaTerm{StatsModels.ContinuousTerm{Float64}, Tuple{StatsModels.MatrixTerm{Tuple{StatsModels.InterceptTerm{true}, StatsModels.CategoricalTerm{DummyCoding, Matrix{Float64}, 2}, StatsModels.CategoricalTerm{DummyCoding, Matrix{Float64}, 2}, StatsModels.CategoricalTerm{DummyCoding, Matrix{Float64}, 1}, StatsModels.CategoricalTerm{DummyCoding, Matrix{Float64}, 4}, StatsModels.ContinuousTerm{Float64}}}, RandomEffectsTerm, RandomEffectsTerm, RandomEffectsTerm}})
   @ JellyMe4 ~/.julia/packages/JellyMe4/PqjLf/src/formula.jl:0
 [2] sexp(#unused#::Type{RCall.RClass{:lmerMod}}, x::Tuple{LinearMixedModel{Float64}, DataFrame})
   @ JellyMe4 ~/.julia/packages/JellyMe4/PqjLf/src/lmerMod.jl:93
 [3] sexp
   @ ~/.julia/packages/RCall/gOwEW/src/convert/default.jl:0 [inlined]
 [4] setindex!(e::Ptr{EnvSxp}, v::Tuple{LinearMixedModel{Float64}, DataFrame}, s::Symbol)
   @ RCall ~/.julia/packages/RCall/gOwEW/src/methods.jl:553
 [5] setindex!(e::RObject{EnvSxp}, v::Tuple{LinearMixedModel{Float64}, DataFrame}, s::Symbol)
   @ RCall ~/.julia/packages/RCall/gOwEW/src/methods.jl:562
 [6] top-level scope
   @ REPL[62]:1

Would be very grateful for any tips :)

@Reulguen
Copy link
Author

Reulguen commented Nov 7, 2023

I figured that the expression ( Report / text) is the issue. Is there a way of avoiding the lack of field sym.?

@palday
Copy link
Owner

palday commented Nov 7, 2023

I think the #71 will fix this. Can you install that branch and test it out? You can install a branch with:

# right bracket to enter package mode
julia> ]

pkg> add JellyMe4#pa/nested_grouping

If it works, then you can go back to the main release series with

pkg> free JellyMe4

(I'll tag a release as soon as that PR is merged.)

@palday
Copy link
Owner

palday commented Nov 13, 2023

I've merged that PR. The release should be out within the hour.

@Reulguen
Copy link
Author

Thank you very much for taking care and also for your support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants