[R] Delete query in sqldf?

Paul Smith phhs80 at gmail.com
Fri Sep 7 20:15:50 CEST 2007


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.
> >
>



More information about the R-help mailing list