Re: [R] Function for Data Frame

2013-04-29 Thread Rolf Turner
On 30/04/13 08:34, MacQueen, Don wrote: Just to add a little, don't get distracted by the return() function. Functions return the value of their final expression, provided it isn't an assignment. Note that functions still return the value of their final expression even if it is an assignment.

Re: [R] Function for Data Frame

2013-04-29 Thread MacQueen, Don
Just to add a little, don't get distracted by the return() function. Functions return the value of their final expression, provided it isn't an assignment. For your example, this will do the job: myfunc <- function(DF) subset(DF, select=-V1) If you want to modify the data frames in place, one wa

Re: [R] Function for Data Frame

2013-04-29 Thread Ben Tupper
Hi, On Apr 29, 2013, at 10:23 AM, Sparks, John James wrote: > Dear R Helpers, > > I have about 20 data frames that I need to do a series of data scrubbing > steps to. I have the list of data frames in a list so that I can use > lapply. I am trying to build a function that will do the data scru

Re: [R] Function for Data Frame

2013-04-29 Thread arun
Hi, If I understand it correctly, x<-myfunc(x) x #  V2 V3 #1  2  3 #2  2  3 #3  2  2 #4  2  2 #5  1  1 A.K. - Original Message - From: "Sparks, John James" To: r-help@r-project.org Cc: Sent: Monday, April 29, 2013 10:23 AM Subject: [R] Function for Data Frame Dear R Helpers, I have

Re: [R] Function for Data Frame

2013-04-29 Thread arun
Hi, If it is for the list: lst1<- list(x,x,x)  lst1<-lapply(lst1,myfunc) - Original Message - From: arun To: "Sparks, John James" Cc: R help Sent: Monday, April 29, 2013 12:13 PM Subject: Re: [R] Function for Data Frame Hi, If I understand it correctly, x<-myfu