Re: [R] Translate the elements of a dataframe

2009-04-16 Thread Gabor Grothendieck
Try this: 2 * (DF == "+") - (DF != "-") On Thu, Apr 16, 2009 at 2:58 PM, Juergen Rose wrote: > The second beginner question. I want to create a new dataframe, where > each element of the original dataframe is translated to 1 if it was "+", > to 0 if it was "-" to -1 otherwise. I could do with:

Re: [R] Translate the elements of a dataframe

2009-04-16 Thread Juergen Rose
Am Donnerstag, den 16.04.2009, 15:14 -0400 schrieb Chuck Cleland: > On 4/16/2009 2:58 PM, Juergen Rose wrote: > > The second beginner question. I want to create a new dataframe, where > > each element of the original dataframe is translated to 1 if it was "+", > > to 0 if it was "-" to -1 otherwise

Re: [R] Translate the elements of a dataframe

2009-04-16 Thread Chuck Cleland
On 4/16/2009 2:58 PM, Juergen Rose wrote: > The second beginner question. I want to create a new dataframe, where > each element of the original dataframe is translated to 1 if it was "+", > to 0 if it was "-" to -1 otherwise. I could do with: > > Lines <- "abcd > +-+ + >

[R] Translate the elements of a dataframe

2009-04-16 Thread Juergen Rose
The second beginner question. I want to create a new dataframe, where each element of the original dataframe is translated to 1 if it was "+", to 0 if it was "-" to -1 otherwise. I could do with: Lines <- "abcd +-+ + +++ - +1- '+ ' -