On 07/12/2010 07:16 PM, Roger Deangelis wrote:

Hi,

   I am new to R.

   I am trying to create an R function to do a SAS proc means/summary

           proc.means ( data=bsebal;
                class team year;
                var ab h;
                output out=BseBalAvg mean=;
              run;)


So you're actually trying to have R generate the SAS code? R is not, in general, a macro language, and attempts to use it as such are fighting against the current.

Since you're writing your own function, you can make it accept as many arguments as you want, even an arbitrary number. For instance,

test <- data.frame(a = rnorm(100), b = rnorm(100, 10), c = rnorm(100, 20))

summarize  <- function(...) {
  dots <- list(...)
  lapply(dots, summary)
}

summarize(test$a, test$b, test$c)

Is that what you'd like?

______________________________________________
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.

Reply via email to