Re: [R] Paste Strings as logical for functions?

2009-05-22 Thread Uwe Ligges



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@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.


__
R-help@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.


[R] Paste Strings as logical for functions?

2009-05-21 Thread tsunhin wong
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)
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@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.