On Mon, 2007-02-19 at 16:13 +0100, Johannes Graumann 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


I may be misunderstanding your desired end result, but what about:

  subset(dataframe,list %in% strsplit(Field, ","))


This way 'Field' is evaluated within the data frame (default behavior
for 'subset') on a row-wise basis, rather than passing the entire
column.

This entire process also presumes that 'Field' has embedded commas,
delimiting component entries. If not, then strsplit() is not required.

HTH,

Marc Schwartz

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to