Re: [R] simple function with if -> lapply to dataframe

2007-10-10 Thread Julian Burgos
Hi Georg, The answer is in the warning message In if (x < 0) a <- -1 else a <- 1 : the condition has length > 1 and only the first element will be used Basically you are passing a vector of length>1 to a control flow expression (if() in this case) that requires only a vector of length one. See

Re: [R] simple function with if -> lapply to dataframe

2007-10-10 Thread Leeds, Mark (IED)
sage- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Georg Ehret Sent: Wednesday, October 10, 2007 3:43 PM To: [EMAIL PROTECTED] Subject: [R] simple function with if -> lapply to dataframe Dear R, I am writing a simple function to extract the sign of values and apply it to

Re: [R] simple function with if -> lapply to dataframe

2007-10-10 Thread Marc Schwartz
On Wed, 2007-10-10 at 15:43 -0400, Georg Ehret wrote: > Dear R, >I am writing a simple function to extract the sign of values and apply it > to a data frame (see below). Whatever I do I get error-messages... What is > wrong? > > Thanking you in advance, > Cheers, Georg. > *

Re: [R] simple function with if -> lapply to dataframe

2007-10-10 Thread James W. MacDonald
Hi Georg, Georg Ehret wrote: > Dear R, >I am writing a simple function to extract the sign of values and apply it > to a data frame (see below). Whatever I do I get error-messages... What is > wrong? The main problem here is you are ignoring existing functions that will do the job much bette

[R] simple function with if -> lapply to dataframe

2007-10-10 Thread Georg Ehret
Dear R, I am writing a simple function to extract the sign of values and apply it to a data frame (see below). Whatever I do I get error-messages... What is wrong? Thanking you in advance, Cheers, Georg. *** Georg Ehret Institute of Genetic Medicine Johns Hopkins University