Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Jeff Newmiller
= c(9,1,15,4,5,17,18)) df2$Date<-as.Date(df2$Date) cbind(df2, sqldf("select strftime( '%m', Date) from df2")) Data formatted according to your example but **not** changed to Dates, correct result df3 <- data.frame(Date = c("2013-05-25","2013-05-28",

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Manohar Reddy
First of all I would like to say thanks to everyone for sharing valuable information, now I can able to do that if date column datatype is “Factor” but by default the date column datatype is “POSIXct” in R ,so whenever I want apply stfrtime function with sqldf package ,do I need to convert the date

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread peter dalgaard
On 16 Sep 2016, at 15:23 , PIKAL Petr wrote: > Hi Peter > > The devil is in detail > > Data from OP had different format and was transferred to Date object by > as.Date, which results in incorrect values (and NA if not transferred) > df <- data.frame(Date = > c("2013/05/25","2013/05/28","201

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Gabor Grothendieck
IKAL Petr wrote: >>> >>> > Hi >>> > >>> > Most probably there is some syntactic suger how to correctly >>formulate sql >>> query. >>> > >>> >> sqldf('select Date, strftime("Date", "%m") fr

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Jeff Newmiller
), Quantity = c(9,1,15,4,5,17,18)) >cbind(df3, sqldf("select strftime( '%m', Date) from df3")) > >so sqldf is a bit peculiar about required input values and does not >know how to handle Date objects. > >Cheers >Petr > > >> -Original Message---

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread PIKAL Petr
013-06-05","2013-06-07"), Quantity = c(9,1,15,4,5,17,18)) cbind(df3, sqldf("select strftime( '%m', Date) from df3")) so sqldf is a bit peculiar about required input values and does not know how to handle Date objects. Cheers Petr > -Original Message- &

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread peter dalgaard
; format(sqldf("select Date from log"), "%m") > > This one however works. > > Cheers > Petr > > From: Manohar Reddy [mailto:manu.redd...@gmail.com] > Sent: Friday, September 16, 2016 11:55 AM > To: PIKAL Petr > Cc: R-help > Subject: Re:

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread PIKAL Petr
: error in statement: no such function: format > format(sqldf("select Date from log"), "%m") This one however works. Cheers Petr From: Manohar Reddy [mailto:manu.redd...@gmail.com] Sent: Friday, September 16, 2016 11:55 AM To: PIKAL Petr Cc: R-help Subject: Re: [R] stf

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Manohar Reddy
uot; "05" "05" "06" "06" "06" "06" > > > > works for me. > > Just a blind guess, is an object date somwhere in your environment? > > Cheers > Petr > > > > -----Original Message- > > From:

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread PIKAL Petr
" > works for me. Just a blind guess, is an object date somwhere in your environment? Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Manohar > Reddy > Sent: Friday, September 16, 2016 6:36 AM > To: R-help > S

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Manohar Reddy
Jeff, Thanks,my question is when I’m using strftime function in sqldf package it’s not returning the results which has supposed to return ,now how can I get the excat month from my sample data with strftime function through sqldf package ? Manu. On Fri, Sep 16, 2016 at 11:32 AM, Jeff Newmi

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-15 Thread Jeff Newmiller
This question is missing pieces... the example is incomplete. -- Sent from my phone. Please excuse my brevity. On September 15, 2016 9:35:45 PM PDT, Manohar Reddy wrote: >Hi , > > > >I have data something looks like below (or PFA), but when I’m >extracting >month using *strftime* function th

[R] stfrtime function not returning proper results through sqldf package in R

2016-09-15 Thread Manohar Reddy
Hi , I have data something looks like below (or PFA), but when I’m extracting month using *strftime* function through *sqldf* library ,it’s returning below results but it’s not returning exact results ,it supposed to return 05,05,05,06,06,06.Can anyone please guide me how to do that with *s