Re: [R] Using loops to run functions over a list of variables

2009-05-12 Thread Matt Killingsworth
Jun, sapply() does the trick! Thank you Jun! I really appreciate your help. -Matt On Tue, May 12, 2009 at 1:20 PM, Jun Shen wrote: > Forgot one thing, make sure your data is a list or data frame. > > > On Tue, May 12, 2009 at 12:19 PM, Jun Shen wrote: > >> I don't think get(factor[i]) will

Re: [R] Using loops to run functions over a list of variables

2009-05-12 Thread Jun Shen
Forgot one thing, make sure your data is a list or data frame. On Tue, May 12, 2009 at 12:19 PM, Jun Shen wrote: > I don't think get(factor[i]) will work. The problem is get only sees a > character string "data$focus" instead of doing "extracting focus from data". > In your case isn't lapply (or

Re: [R] Using loops to run functions over a list of variables

2009-05-12 Thread Jun Shen
I don't think get(factor[i]) will work. The problem is get only sees a character string "data$focus" instead of doing "extracting focus from data". In your case isn't lapply (or sapply) good enough? sapply (data, summary) try ?lapply for details Jun On Tue, May 12, 2009 at 10:55 AM, rapton wrot

[R] Using loops to run functions over a list of variables

2009-05-12 Thread rapton
Hello, I have a data set with many variables, and often I want to run a given function, like summary() or cor() or lmer() etc. on many combinations of one or more than one of these variables. For every combination of variables I want to analyze I have been writing out the code by hand, but given