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

Error in if(!INT & isGam.y) { : the condition has length > 1 #57

Open
sebsilas opened this issue May 12, 2023 · 3 comments
Open

Error in if(!INT & isGam.y) { : the condition has length > 1 #57

sebsilas opened this issue May 12, 2023 · 3 comments

Comments

@sebsilas
Copy link

I recently updated R and my packages and the below code, which was previously working, is no longer working:

fit.dv <- lme4::lmer(opti3 ~ no_recalled_notes + N + condition + log(attempt) + log(attempt):N + (1|unique_melody_name), data = na.omit(main2))

fit.mediator <- lme4::lmer(no_recalled_notes ~ N + condition + log(attempt) + log(attempt):N + (1|unique_melody_name), data = na.omit(main2))

results <- mediation::mediate(fit.mediator, fit.dv, treat = c('N', 'condition'), mediator = 'no_recalled_notes')

The error is:

Error in if(!INT & isGam.y) { : the condition has length > 1

@evagrosfeld
Copy link

Good afternoon, I have a similar problem. Have you already resolved the issue?

@sebsilas
Copy link
Author

sebsilas commented Jul 10, 2023

Hi @evagrosfeld. Yes, I think it's because you can only have one treat variable (I just noticed this in the documentation). I moved one of my treat variables (condition in my example above) to the covariates argument, and it works now.

Were you trying to use two or more variables for treat?

@evagrosfeld
Copy link

Indeed, I was. Thank you, inserting one of the treat variables as covariates variable solves the issue!

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

No branches or pull requests

2 participants