Re: [R] function closure

2013-08-12 Thread Ashwani Rao
> > > glob2rx("*.xml") > > [1] "^.*\\.xml$" > > ** ** > > Bill Dunlap**** > > Spotfire, TIBCO Software > > wdunlap tibco.com > > ** ** > > *From:* Ashwani Rao [mailto:ashwamegh1...@gmail.com] > *Sen

Re: [R] function closure

2013-08-12 Thread William Dunlap
to regular expressions. > glob2rx("*.xml") [1] "^.*\\.xml$" Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com From: Ashwani Rao [mailto:ashwamegh1...@gmail.com] Sent: Monday, August 12, 2013 10:04 AM To: William Dunlap Cc: r-help@r-project.org Subject: Re: [R] functio

Re: [R] function closure

2013-08-12 Thread jim holtman
Try changing the assignment to use "<<-" fileindex <<- fileindex + 1 On Mon, Aug 12, 2013 at 12:44 PM, Ashwani Rao wrote: > Hi, > > Just for fun, I wanted to try function closures. > Here is simple function definition. > The following "generateFiles" function return function "fileGen"

Re: [R] function closure

2013-08-12 Thread Ashwani Rao
, pattern="\\.R$") > > nextFile() > [1] 1 > [1] "c:/temp/4209/test.R" > > nextFile() > [1] 2 > [1] "c:/temp/a.R" > > Bill Dunlap > Spotfire, TIBCO Software > wdunlap tibco.com > > > > -Original Message---

Re: [R] function closure

2013-08-12 Thread William Dunlap
1 [1] "c:/temp/4209/test.R" > nextFile() [1] 2 [1] "c:/temp/a.R" Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Ashwani Ra

[R] function closure

2013-08-12 Thread Ashwani Rao
Hi, Just for fun, I wanted to try function closures. Here is simple function definition. The following "generateFiles" function return function "fileGen" which will return a a regular file in directory , every time a call it (fileGen). generateFiles <- function(path, pattern="*.xml") {