[R] Another subsetting enigma

Johannes Graumann johannes_graumann at web.de
Mon Feb 19 18:25:45 CET 2007


On Monday 19 February 2007 17:49, jim holtman wrote:
> have you tried 'unlist(strsplit(....))'?    The 'unlist' will probably give
> you more values than you have rows, so it would be good if you could
> explain what it is you are trying to do.
I want to isolate a data frame containing all rows of 'dataframe' which 
contain a member of 'list' in the field 'Field', which itself is a comma 
separated list of entries.

Better this (know in brain ...)?

Joh

> On 2/19/07, Johannes Graumann <johannes_graumann at web.de> wrote:
> > Hello again,
> >
> > I'm trying to do the following:
> >
> > subset(dataframe,list %in% strsplit(dataframe[[Field]],","))
> >
> > But This returns always the complete dataframe, since the
> > strsplit(dataframe[[Field]],",") is evaluated as one big list for the
> > whole
> > data frame rather than one list per row. How can I have this evaluated on
> > a
> > per row basis?
> >
> > After 1.5 h hitting head against wall - begging for insights ...
> >
> > Joh
> >
> > ______________________________________________
> > 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20070219/3d05a24c/attachment.bin 


More information about the R-help mailing list