我必须适应几种元回归模型,并且试图编写一个for循环,其中将不同的变量名称传递给escalc函数。
任务如下:
public static void ConsoleLog(this Page page, string msg)
{
msg = msg.Replace("'", ""); //Prevent js parsing errors. Could also add in an escape character instead if you really want the 's.
page.Response.Write("<script>console.log('"+msg+"');</script>");
}
但是这失败并显示错误。
如何将变量名传递给escalc?
答案 0 :(得分:0)
有点难看,但这应该可以工作:
dat <- escalc(measure="RR", ai=eval(parse(text=some_vars[1])),
bi=eval(parse(text=some_vars[2])),
ci=eval(parse(text=some_vars[3])),
di=eval(parse(text=some_vars[4])), data=dat)