On Thu, 13 Mar 2008, Dwayne Blind wrote:
> Thanks a lot.
>
> You were right :-)
>
> Professor Ripley can I use your SPLUS book for R too ?
'Modern Applied Statistics with S' and 'S Programming' both cover S and
its implementations in S-PLUS and R.
However, 'Modern Applied Statistics with S-PLUS
Thanks a lot.
You were right :-)
Professor Ripley can I use your SPLUS book for R too ?
2008/3/12, Prof Brian Ripley <[EMAIL PROTECTED]>:
>
> On Wed, 12 Mar 2008, Dwayne Blind wrote:
>
>
> > Dear R users,
> >
> > I wrote the following toy example to explain my problem :
> >
> > a=0
> > f=functio
On Wed, 12 Mar 2008, Dwayne Blind wrote:
> Dear R users,
>
> I wrote the following toy example to explain my problem :
>
> a=0
> f=function(x,y,z) {
>if (a==0) x[1]+x[2]+y
>if (a!=0) x[1]+x[2]+y+z
> }
> f(1:2,3)
>
>
> I have not specified z and I get an error.
What was the error? It work
You just need to return the values computed when a==0 and when a!=0.
a=0
f=function(x,y,z=0) {
if (a==0) return(x[1]+x[2]+y)
if (a!=0) return(x[1]+x[2]+y+z)
}
> f(1:2,3)
[1] 6
>
Ravi.
---
Ravi Varadhan, Ph
4 matches
Mail list logo