[R] SAS Proc summary/means as a R function
Erik Iverson
eriki at ccbr.umn.edu
Tue Jul 13 05:59:21 CEST 2010
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?
More information about the R-help
mailing list