Hi I am trying to define a function fu() in the following way but when I try to run I get the error that ma1 is not found. I am not sure where I am going wrong? Does the scope of ma1 not extend to an expr.frame object? expr.frame() is under library tradesys.
function (y,ma1,ma2) { x <- y[, c("Open","Close")] d <- expr.frame(x, list(MAf=quote(SMA(Close, ma1)), MAs=quote(SMA(Close, ma2)))) } >fu(spx,60,120) Error in runSum(x, n) : object 'ma1' not found Thanks for your kind help. -- 'Raghu' [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.