Re: [R] Adding Column to Data Frames Using a Loop

2013-05-02 Thread MacQueen, Don
I'm a little puzzled, because you're asking for something simpler than for(i in letters[24:26] ) assign( i, myfunc(get(i))) and suggesting things along the lines of assign(paste(i,"$V4",sep=""),paste(get(i),"$V2+",get(i),"$V3",sep="")) To me, the former is much simpler, much easier to read and

Re: [R] Adding Column to Data Frames Using a Loop

2013-05-01 Thread arun
Hi, You could use: library(plyr) for(i in letters[24:26]) assign(i,mutate(get(i),V4=V2+V3))  x  # V1 V2 V3 V4 #1  1  2  3  5 #2  1  2  3  5 #3  1  2  2  4 #4  1  2  2  4 #5  1  1  1  2  y #  V1 V2 V3 V4 #1  1  2  3  5 #2  1  2  3  5 #3  1  2  2  4 #4  1  2  2  4 #5  1  1  1  2 A.K. >Dear R Help

Re: [R] Adding Column to Data Frames Using a Loop

2013-05-01 Thread William Dunlap
> I am trying to do calculations on multiple data frames and do not want to > create a list of them to go through each one. I know that lists have many > wonderful advantages, but I believe the better thing is to work df by df > for my particular situation. Can you give some details about why y