[R] a small puzzle?

2010-07-12 Thread Raghu
I know the following may sound too basic but I thought the mailing list is for the benefit of all levels of people. I ran a simple if statement on two numeric vectors (news1o and s2o) which are of equal length. I have done an str on both of them for your kind perusal below. I am trying to compare

Re: [R] a small puzzle?

2010-07-12 Thread jim holtman
You probably want to use ifelse s - ifelse(news1os2o, 1, -1) 'if' only handle a single logical expression. On Mon, Jul 12, 2010 at 10:02 AM, Raghu r.raghura...@gmail.com wrote: I know the following may sound too basic but I thought the mailing list is for the benefit of all levels of people.

Re: [R] a small puzzle?

2010-07-12 Thread Alain Guillet
In an if statement, you can use only elements. In your example, news1o and s2o are vectors so there is a warning saying the two vectors have a bigger length than one. If you don't send two messages about the same problem in two minutes, you can see what people answer you... For example, I