Re: [R] How to modify function for list

2007-10-03 Thread Chung-hong Chan
Yeah, it works fine now. I think I need to modify my function to check for factor. Regards, C On 10/3/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > On 03/10/2007 2:23 AM, Chung-hong Chan wrote: > > Thanks for your answer. But I have a strange question that I don't > > know how to explain and I

Re: [R] How to modify function for list

2007-10-03 Thread Duncan Murdoch
On 03/10/2007 2:23 AM, Chung-hong Chan wrote: > Thanks for your answer. But I have a strange question that I don't > know how to explain and I really don't know how to spot the > problematic part. > > Suppose I have a long list of age, gender and bmi from a data.frame > called msltdata. > >> age

Re: [R] How to modify function for list

2007-10-03 Thread Chung-hong Chan
Yes, I tried. Wrong calculation. On 10/3/07, Stefan Grosse <[EMAIL PROTECTED]> wrote: > On Wednesday 03 October 2007 08:23:15 Chung-hong Chan wrote: > CC > > CC > Suppose I have a long list of age, gender and bmi from a data.frame > CC > called msltdata. > CC > > CC > > age <- msltdata$age > CC >

Re: [R] How to modify function for list

2007-10-03 Thread Stefan Grosse
On Wednesday 03 October 2007 08:23:15 Chung-hong Chan wrote: CC > CC > Suppose I have a long list of age, gender and bmi from a data.frame CC > called msltdata. CC > CC > > age <- msltdata$age CC > > gender <- msltdata$data CC > > bmi <-msltdata$bmi CC > > age CC > [1] 5 10 14 CC > > gender CC > [

Re: [R] How to modify function for list

2007-10-02 Thread Chung-hong Chan
Thanks for your answer. But I have a strange question that I don't know how to explain and I really don't know how to spot the problematic part. Suppose I have a long list of age, gender and bmi from a data.frame called msltdata. > age <- msltdata$age > gender <- msltdata$data > bmi <-msltdata$bm

Re: [R] How to modify function for list

2007-10-02 Thread Christos Hatzis
Instead of > bmisds(age,gender,bmi) Try the vectorized version > mapply(bmisds, age, gender, bmi) See ?mapply -Christos > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Chung-hong Chan > Sent: Wednesday, October 03, 2007 12:31 AM > To: [EMA