Mangalani Peter Makananisa
2017-Aug-11 13:21 UTC
[R] Package sqldf in R and dates manipulation
Dear all, I recently read the book " R data preperation and manipulation using sqldf package" by Djoni Darmawikarta However, I have a problem with manipulation of dates using this package, I do not get the expected results. Do I need to install some packages to be able to subset the data by dates in sqldf? I am not getting Djoni Darmawikarta email address. Please see the practice data attached and advise, Kind regards, Mangalani Peter Makananisa (0005786) South African Revenue Service (SARS) Specialist: Statistical Support TCEI_OR (Head Office) Tell: +2712 422 7357, Cell: +2782 456 4669 product = read.csv('D:/Users/S1033067/Desktop/sqldf prac/sqlprac.csv', na.strings = '', header = T) head(product) library(sqldf) sqldf() # out-put> sqldf("select * from product+ where (date(Launch_dt) >= date('01-01-2003')) + ") [1] P_Code P_Name Launch_dt Price <0 rows> (or 0-length row.names)>Please Note: This email and its contents are subject to our email legal notice which can be viewed at http://www.sars.gov.za/Pages/Email-disclaimer.aspx [[alternative HTML version deleted]]
See FAQ #4 on the sqldf github home page. On Fri, Aug 11, 2017 at 9:21 AM, Mangalani Peter Makananisa <pmakananisa at sars.gov.za> wrote:> Dear all, > > I recently read the book " R data preperation and manipulation using sqldf package" by Djoni Darmawikarta > However, I have a problem with manipulation of dates using this package, I do not get the expected results. Do I need to install some packages to be able to subset the data by dates in sqldf? > > I am not getting Djoni Darmawikarta email address. > > Please see the practice data attached and advise, > > Kind regards, > > Mangalani Peter Makananisa (0005786) > South African Revenue Service (SARS) > Specialist: Statistical Support > TCEI_OR (Head Office) > Tell: +2712 422 7357, Cell: +2782 456 4669 > > > product = read.csv('D:/Users/S1033067/Desktop/sqldf prac/sqlprac.csv', na.strings = '', header = T) > head(product) > library(sqldf) > sqldf() > > # out-put > >> sqldf("select * from product > + where (date(Launch_dt) >= date('01-01-2003')) > + ") > [1] P_Code P_Name Launch_dt Price > <0 rows> (or 0-length row.names) >> > > Please Note: This email and its contents are subject to our email legal notice which can be viewed at http://www.sars.gov.za/Pages/Email-disclaimer.aspx > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.-- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
Mangalani Peter Makananisa
2017-Aug-12 10:17 UTC
[R] Package sqldf in R and dates manipulation
Thank you very much for the help you provided. RH2. -----Original Message----- From: Gabor Grothendieck [mailto:ggrothendieck at gmail.com] Sent: 11 August 2017 05:49 PM To: Mangalani Peter Makananisa Cc: r-help at r-project.org; Vito Ricci (vito_ricci at yahoo.com); manginduvho at gmail.com Subject: Re: [R] Package sqldf in R and dates manipulation See FAQ #4 on the sqldf github home page. On Fri, Aug 11, 2017 at 9:21 AM, Mangalani Peter Makananisa <pmakananisa at sars.gov.za> wrote:> Dear all, > > I recently read the book " R data preperation and manipulation using > sqldf package" by Djoni Darmawikarta However, I have a problem with manipulation of dates using this package, I do not get the expected results. Do I need to install some packages to be able to subset the data by dates in sqldf? > > I am not getting Djoni Darmawikarta email address. > > Please see the practice data attached and advise, > > Kind regards, > > Mangalani Peter Makananisa (0005786) > South African Revenue Service (SARS) > Specialist: Statistical Support > TCEI_OR (Head Office) > Tell: +2712 422 7357, Cell: +2782 456 4669 > > > product = read.csv('D:/Users/S1033067/Desktop/sqldf prac/sqlprac.csv', > na.strings = '', header = T) > head(product) > library(sqldf) > sqldf() > > # out-put > >> sqldf("select * from product > + where (date(Launch_dt) >= date('01-01-2003')) > + ") > [1] P_Code P_Name Launch_dt Price > <0 rows> (or 0-length row.names) >> > > Please Note: This email and its contents are subject to our email > legal notice which can be viewed at > http://www.sars.gov.za/Pages/Email-disclaimer.aspx > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.-- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com Please Note: This email and its contents are subject to our email legal notice which can be viewed at http://www.sars.gov.za/Pages/Email-disclaimer.aspx [[alternative HTML version deleted]]