gamlj error when reproducing in Rstudio

Discuss the jamovi platform, possible improvements, etc.
Post Reply
rjs
Posts: 3
Joined: Sun Sep 06, 2020 1:37 am

gamlj error when reproducing in Rstudio

Post by rjs »

Hi there, first posting;

I am trying to re-run code generated by the GAMLJ module (in Jamovi) in Rstudio and am getting a consistent error (i.e., using both a GLM and a mixed model approach) while executing exported code:

"Error: Argument 'covs' requires a numeric variable ('some_factor' is not valid)" See mockup of actual code exported below:

gamlj::gamljGLM(
formula = `dependent_variable` ~ `some_factor` * `another_factor` * `a_third_factor`,
data = data)

I installed the gamlj package and ran above code. This error seems odd to me as I am using a formula, and according to GAMLJ package descriptions, 'covs' is not required when using a formula?

Any idea what this error may be referring to? Adding "covs=NULL" for example doesn't help.

Thanks for any insight, RJS
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: gamlj error when reproducing in Rstudio

Post by jonathon »

hi,

i think we'll need a reproducible example to understand what's going on here.

i've just done a quick test on the ToothGrowth data set, and it works:

gamlj::gamljGLM(ToothGrowth, formula=len~dose*supp)

so there's something unexpected about your data.

cheers

jonathon
rjs
Posts: 3
Joined: Sun Sep 06, 2020 1:37 am

Re: gamlj error when reproducing in Rstudio

Post by rjs »

Gotcha. I will have a look and get back to you.
rjs
Posts: 3
Joined: Sun Sep 06, 2020 1:37 am

Re: gamlj error when reproducing in Rstudio

Post by rjs »

Ok I figured this out. Rstudio did not recognize my "some_factor" for a factor properly. Once I told her it was a factor indeed, all worked well. I suppose gamljGLM() does the checking in the background. Thanks!
-RJS
Post Reply