Re: [R] subset or condition as argument to a function

2009-12-11 Thread Santosh
Thanks so much for the tips, I was able to use both parse() and eval()... I found eval(), quote(), bquote() easier and more flexible to use and to pass as arguments to a function. I can't say enough that you really made my day! :) Thanks, Santosh On Tue, Dec 1, 2009 at 9:36 AM, baptiste auguie

Re: [R] subset or condition as argument to a function

2009-12-01 Thread Santosh
Dear R gurus.. I had tried out some suggestions sent to me privately..and unfortunately, they did not work.. To use a condiition in a subset, the associated dataframe needs to be attached and detached, which I found cumbersome to use if using more than 1 dataframe (with different dimensions) with

Re: [R] subset or condition as argument to a function

2009-12-01 Thread David Winsemius
On Dec 1, 2009, at 10:38 AM, Santosh wrote: Dear R gurus.. I had tried out some suggestions sent to me privately..and unfortunately, they did not work.. To use a condiition in a subset, the associated dataframe needs to be attached and detached, which I found cumbersome to use if using

Re: [R] subset or condition as argument to a function

2009-12-01 Thread David Winsemius
On Dec 1, 2009, at 10:55 AM, David Winsemius wrote: On Dec 1, 2009, at 10:38 AM, Santosh wrote: Dear R gurus.. I had tried out some suggestions sent to me privately..and unfortunately, they did not work.. To use a condiition in a subset, the associated dataframe needs to be attached and

Re: [R] subset or condition as argument to a function

2009-12-01 Thread David Winsemius
On Dec 1, 2009, at 11:04 AM, David Winsemius wrote: On Dec 1, 2009, at 10:59 AM, David Winsemius wrote: On Dec 1, 2009, at 10:55 AM, David Winsemius wrote: On Dec 1, 2009, at 10:38 AM, Santosh wrote: Dear R gurus.. I had tried out some suggestions sent to me privately..and

Re: [R] subset or condition as argument to a function

2009-12-01 Thread David Winsemius
On Dec 1, 2009, at 10:59 AM, David Winsemius wrote: On Dec 1, 2009, at 10:55 AM, David Winsemius wrote: On Dec 1, 2009, at 10:38 AM, Santosh wrote: Dear R gurus.. I had tried out some suggestions sent to me privately..and unfortunately, they did not work.. To use a condiition in a

Re: [R] subset or condition as argument to a function

2009-12-01 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Santosh Sent: Tuesday, December 01, 2009 7:39 AM To: r-help@r-project.org Subject: Re: [R] subset or condition as argument to a function Dear R gurus.. I had tried out some

Re: [R] subset or condition as argument to a function

2009-12-01 Thread baptiste auguie
Hi, an alternative to parse() is to use quote and bquote, set.seed(123) d = data.frame(a=letters[1:5], b=1:10, c=sample(0:1, 10, repl=TRUE)) cond1 - quote(a==b) cond2 - quote(b 6) cond3 - bquote(.(cond1) .(cond2)) subset(d, eval(cond1)) subset(d, eval(cond2)) subset(d, eval(cond3)) HTH,

Re: [R] subset or condition as argument to a function

2009-11-21 Thread Bernardo Rangel Tura
On Fri, 2009-11-20 at 17:40 -0800, Santosh wrote: Dear Rxperts! I was wondering if it is possible to write a function which can take in argument of a subset or condition.. Of course, I am aware of the alternate methods like coplot, par.plot, xyplot etc... I am specifically interested in

[R] subset or condition as argument to a function

2009-11-20 Thread Santosh
Dear Rxperts! I was wondering if it is possible to write a function which can take in argument of a subset or condition.. Of course, I am aware of the alternate methods like coplot, par.plot, xyplot etc... I am specifically interested in using conditions/subsets with plot.. A simple fragmented

Re: [R] subset or condition as argument to a function

2009-11-20 Thread Santosh
To further explain my case.. am reproducing one of the examples.from one of contributors' guides.. ___ attach(ais) here- sex==f plot(pcBfat[here]~ht[here], xlab = “Height”, ylab = “% Body fat”) panel.smooth(ht[here],pcBfat[here]) detach(ais) __ A condition is in here,... I