[R] Paste Strings as logical for functions?

Uwe Ligges ligges at statistik.tu-dortmund.de
Fri May 22 12:09:00 CEST 2009



tsunhin wong wrote:
> Dear R Users,
> 
> I have some dynamic selection rules that I want to pass around for my functions:
> 
>> rules <- paste(g$TrialList==1 & g$Session==2)

I guess you do not want to paste() at all:

rules <- g$TrialList==1 & g$Session==2

Uwe Ligges


>> myfunction <- function(rules) {
>>   index <- which(rules)
>>   anotherFunction(index)
>> }
> 
> However, I can't find a way to pass around these selection rules
> easily (for subset, for which, etc)
> Please let me know if you have some idea.
> 
> Thank you very much!
> 
> - John
> 
> ______________________________________________
> R-help at r-project.org 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