Closed lujiacn closed 8 years ago
So would this offer a method which you pass say a map of objects in, the library converts to a R eval string which is ran before other evaluations. So something like the following?
value, err := rClient.Eval("x * y", map[string]interface{}{
"x" : 2,
"y" : 3,
})
Sorry for late reply. One scenario in my project is passing parameters to R and do the calculation. The solution is using struct tag conduct the assignment string. The code may be looks like:
type Info struct { Height string `r:"height"` Weight string `r:"weight"` } Tom := &Info{170, 65} r.StructAssign(TOM) // will have height, weight defined in R bmi, err := r.Eval("func_bmi(height, weight)")
May be the function is not so generic for common use.
I think the requirement is generic, in fact I think we could immediately benefit from this functionality at Senseye. However, I am not sure how best to implement it, it could be a lot of work. I will think on it a little more. Great suggestion!
Hi Daniel,
Do you plan implement some basic assignment functions? Which can assign go variable values to R variable. May be start from string array -> string vector or others. If do so, any idea how to programming. May be convert go values to strings with R eval format and evaluate the string?
Regards, Jia