Having thought I had solved this, I am still having a few problems.
I think I did not fully appreciate that DSLite does not feature the parser, and so during development I was doing things that are not permitted by the parser. @yannick, please can you confirm that DSLite does not feature the parser and hence I cannot use it to test ways of passing through the formulae?
It seems that the only way I can get this to work with the current parser is to make my mixed model formula look like a standard GLM formula by substituting the pipe and brackets for other strings:
formula <- "BMI ~ trtGrp + Male+ (1|idSurgery)"
formula <- gsub("|", "xxxxx", formula, fixed = TRUE)
formula <- gsub("(", "yyyyy", formula, fixed = TRUE)
formula <- gsub(")", "zzzzz", formula, fixed = TRUE)
forumla_to_send <- as.formula(formula)
and then reverse this on the server side. My concern is that this looks a bit clumsy and is trying to cheat the parser.
I don’t think it is feasible to split the formula into 3 arguments (‘fixed.effects’, ‘random.effect.before.pipe’, ‘random.effect.after.pipe’) because I think this constrains us to having one random effect, or at least having to define a specified number of random effects.
The other option might be to change the parser, because at the moment I think it must understand that a ‘+’ and ‘~’ are allowed in a formula but not a string. So then a ‘|’, ‘(’ and ‘)’ could be added as permitted in a formula. Is that correct? The disadvantage of this is that I presume it would be tied to an Opal release.