Re: [R] SQL like manipulations on data frames

From: Antonio, Fabio Di Narzo <antonio.fabio_at_gmail.com>
Date: Tue 09 May 2006 - 00:31:09 EST

Do you know the RSQLite package? It uses the DBI package which gives a common interface to various DB engines.
With it, you can explicitely treat data.frames as tables, and execute SQL querys on them.

Antonio, Fabio Di Narzo.

2006/5/5, Robert Citek <rwcitek@alum.calberkeley.org>:
>
>
> Is there a cheat-sheet anywhere that describes how to do SQL-like
> manipulations on a data frame?
>
> My knowledge of R is rather limited. But from my experience it seems
> as though one can think of data frames as being similar to tables in
> a database: there are rows, columns, and values. Also, one can
> perform similar manipulations on a data frame as one can on a table.
> For example:
>
> select * from foo where bar < 10 ;
>
> is similar to
>
> foo[foo["bar"] < 10,]
>
> I'm just wondering how many other SQL-like manipulations can be done
> on a data frame? As an extreme example, is it reasonable to assume
> there is an R equivalent to:
>
> select bar, bat, baz, baz*100 as 'pctbaz' from foo where bar like %xyz
> % order by bat, baz desc ;
>
> Regards,
> - Robert
> http://www.cwelug.org/downloads
> Help others get OpenSource software. Distribute FLOSS
> for Windows, Linux, *BSD, and MacOS X with BitTorrent
>
> ______________________________________________
> R-help@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
>

        [[alternative HTML version deleted]]



R-help@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 Received on Tue May 09 00:36:12 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 09 May 2006 - 02:09:59 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.