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
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
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.
> *
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
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
5 matches
Mail list logo