Skip to content
Back to formatted view

Raw Message

Message-ID: <6ade6f6c0709071115u431c5d22x1fcf02902fc93f46@mail.gmail.com>
Date: 2007-09-07T18:15:50Z
From: Paul Smith
Subject: Delete query in sqldf?
In-Reply-To: <971536df0709070832o771a9f0bte6f39ddba77e7235@mail.gmail.com>

On 9/7/07, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> Yes but delete does not return anything so its not useful.  In the devel
> version of sqldf you can pass multiple command so try this using the
> builtin data frame BOD noting that the record with demand = 8.3 was
> removed:
>
> > library(sqldf)
> Loading required package: RSQLite
> Loading required package: DBI
> Loading required package: gsubfn
> Loading required package: proto
> > # overwrite with devel version of the sqldf.R file
> > source("http://sqldf.googlecode.com/svn/trunk/R/sqldf.R")
> > sqldf(c("delete from BOD where demand = 8.3", "select * from BOD"))
>   Time__1 demand
> 1       2   10.3
> 2       3   19.0
> 3       4   16.0
> 4       5   15.6
> 5       7   19.8

I see, Gabor, but I would expect as more natural to have

sqldf("delete from BOD where demand = 8.3")

working, with no second command.

Paul


> On 9/7/07, Paul Smith <phhs80 at gmail.com> wrote:
> > Dear All,
> >
> > Is sqldf equipped with delete queries? I have tried delete queries but
> > with no success.
> >
> > Thanks in advance,
> >
> > Paul
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch 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.
> >
>