I am using the following function from github (https://github.com/nguforche/MEml/blob/master/R/MEml.R#L110).
MEml2 <- function(method, data, id, resp.vars, rhs.vars, rand.vars=NULL, para, ...){
mod.res <- tryCatch(
{
trn <- data[, unique(c(resp.vars, rhs.vars, rand.vars, id)), drop = FALSE]
Train_MEml()[[method]](trn=trn, para=para, resp.vars=resp.vars, rand.vars=rand.vars, rhs.vars=rhs.vars, groups = id)
}, error=function(e){
cat("Error in the Expression: ", paste(e$call, collapse= ", "),
": original error message = ", e$message, "\n")
list()
}) ## tryCatch
collect.garbage()
return(mod.res)
}
I do not know what the line Train_MEml()[[method]](trn=trn, para=para, resp.vars=resp.vars, rand.vars=rand.vars, rhs.vars=rhs.vars, groups = id) is doing. It seems that it is calling a function. However, there is no function called Train_MEml in corresponding MEml package.
In the package, there are other functions coming with UseMethod(method) where corresponding method substituted here.
Q1: What is Train_MEml()[[method]](trn=trn, para=para, resp.vars=resp.vars, rand.vars=rand.vars, rhs.vars=rhs.vars, groups = id) doing here?
Q2: What is Train_MEml()[[method]] doing?