On Sat, May 12, 2012 at 6:18 PM, Shivam <shivamsi...@gmail.com> wrote: > Hi, > > I have a query about sqldf, and dates in general. I couldnt find much on > the net or on the forums, hence I am here. Here is the issue: > > I want to write a function that accepts 3 arguments: date1, date2 and a > dataframe, say 'df'. Within the function, I want to populate a temp > dataframe which essentially contains the output of the query "select * from > df where DATE between date1 and date2". DATE is a column (of class Date) > which will be present in the input dataframe. This is how the function will > look like: > > testfun = function("date1", "date2", df){ > temp = sqldf("select * from df where DATE between 'date1' and 'date2'") > return(temp) #not sure if I'm doing this correctly > }
See FAQ 4 on the sqldf home page. http://sqldf.googlecode.com -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.