[R] dataTable manipulation in R
MSchwartz at mn.rr.com
Sun Nov 6 18:59:04 CET 2005
I suspect that Xiaofan was looking for the use of a function like
subset(), which of course does enable one to specify filtering criteria
and return a subset of rows in a data frame that satisfy the criteria.
I am presuming that the SQL reference was more towards using SQL
Select/Where type statements within a database as an example, as opposed
to wanting to query a SQL database from within R.
Xiaofan, see ?subset for more information. The function will also let
you specify a subset of columns using the 'select' argument.
In addition to subset(), there is also the use of [.data.frame, which
will enable you to specify criteria using the typical "[row, column]"
extraction approach. See ?"[.data.frame" for more information.
Which approach is taken is to some extent personal preference. I find it
easier to use subset() when the criteria are more complex boolean
expressions and/or where I only want a subset of the columns.
On Sun, 2005-11-06 at 17:44 +0000, Adaikalavan Ramasamy wrote:
> Check out the R Data Import/Export manual, especially
> and the RMySQL package.
> On Sun, 2005-11-06 at 03:37 +0000, Xiaofan Li wrote:
> > Dear colleague,
> > Is it able in R to manipulate data tables as in SQL-based databases?
> > Is there any good method in R to locate a special subset of data rows, which
> > satisfy a certain expression of restrictions (e.g. dataTable$peakValue <
> > 3.0)? Then if located, is it able for manipulations, for example, to delete
> > them from the dataTable?
> > Cheers,
> > Xiaofan
More information about the R-help