Is it possible to read in a string into the r tool and use it as a formula?
For example, if I take a workflow that produces an r formula in a string format (i.e. glm(freq ~ marriage + state + age + length)) and put that into an r tool input, can I then read that into r and use that as a formula? Currently the code is as follows but not yielding results I want:
#run the spline model
spline <- read.Alteryx("#2", mode = "list")
fit <- glm(as.formula(spline), family = quasipoisson(link="log"), data = the_data )
Solved! Go to Solution.
Hi @jbh1128d1
It sounds like you're in need of a batch macro! By wrapping the R tool in a macro you could pass the r formula string to the R code via a control parameter. Using the control parameter of a batch macro is a great way to pass dynamically changing information into any tool in the alteryx palette.
Let me know if this helps!
Thanks Tony. It that didn't yield great results either. I did figure out how to bring in the string by pulling in the output as a data.frame then pulling the string out as a value itself and code it as a as.formula to use. Essentially I copied the method used in the out of the box count regression tool.
I appreciate the reply.
User | Count |
---|---|
17 | |
15 | |
15 | |
8 | |
5 |