Re: [R] How to repeat code snippet for several variables in a data frame?

2005-08-16 Thread Sean O'Riordain
Sander, consider writing a function to do your plotting, then pass in the dataframe name so... something along the lines of... # create a function which takes two arguments # mydf - a dataframe of a particular format... eg. the abc column is number 4 # i the column we want to aggregate and plot

Re: [R] How to repeat code snippet for several variables in a data frame?

2005-08-16 Thread Uwe Ligges
Sander Oom wrote: Dear all, I have a data frame containing the results of an experiment. Like this: a-seq(1,4,by=1) b-seq(1,2,by=1) test-expand.grid(b,a,a) colnames(test)-c(replicates,bins, groups) test$abc - rnorm(32) test$def - rnorm(32) test$ghi - rnorm(32) test The following

Re: [R] How to repeat code snippet for several variables in a data frame?

2005-08-16 Thread Sander Oom
Thanks for the very useful tips! Now I have enough round and square bracket and other tricks to wrap up the function! The double square bracket trick in test[[varname]] is golden! Thanks again, Sander. __ R-help@stat.math.ethz.ch mailing list

[R] How to repeat code snippet for several variables in a data frame?

2005-08-15 Thread Sander Oom
Dear all, I have a data frame containing the results of an experiment. Like this: a-seq(1,4,by=1) b-seq(1,2,by=1) test-expand.grid(b,a,a) colnames(test)-c(replicates,bins, groups) test$abc - rnorm(32) test$def - rnorm(32) test$ghi - rnorm(32) test The following code snippet aggregates the data