sqldf has some facilities for Date class but has no knowledge of date class.
See example 7b on home page: http://sqldf.googlecode.com
and here is a second example:
> DF <- data.frame(D =
as.Date(c("21DEC2006","15DEC2006"), "%d%b%Y"))
> DF
D
1 2006-12-21
2 2006-12-15> sqldf("select * from DF")
D
1 2006-12-21
2 2006-12-15
On Tue, Jan 6, 2009 at 1:09 PM, <si.fu at ntlworld.com>
wrote:> Hello,
>
> I am having trouble with retrieving some data in queries involve with
variables
> with data type "date". See the enclosed example:
>
> ll<-c("21DEC2006","15DEC2006")
> ss<-data.frame(ll)
> ss<-transform(ss,ll=as.date(as.character(ll)))
> (ss)
> ll
> 1 17156
> 2 17150
>
> tt<-sqldf("select ll from ss")
>
> (tt)
>>
> ll
> 1 NA
> 2 NA
>
>> str(ss)
> 'data.frame': 2 obs. of 1 variable:
> $ ll:Class 'date' int [1:2] 17156 17150
>
>> str(tt)
> 'data.frame': 2 obs. of 1 variable:
> $ ll:Class 'date' int [1:2] NA NA
>
> So all the elements of ll (of tt) has been converted into NA. Is there
anyway that I can query the variables with "date" data type using
sqldf?
>
>
> Many Thanks,
>
> Si.
>
> ______________________________________________
> R-help at 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.
>