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 the
numbers in both and initiate a new vector s as 1 or 0 depending on if the
elements in the arrays are greater or lesser than each other. When I do a
simple s=(news1o>s2o) I get the values of S as a string of TRUEs and FALSEs
but when I try to override using the if statements this cribs. I get only
one element in s and that is a puzzle. Any ideas on this please? Many
thanks.


if(news1o>s2o)(s<-1) else
+ (s<--1)
[1] -1
Warning message:
In if (news1o > s2o) (s <- 1) else (s <- -1) :
  the condition has length > 1 and only the first element will be used
> s
[1] -1
> length(s)
[1] 1
 str(news1o)
 num [1:3588] 891 890 890 888 886 ...
> str(s2o)
 num [1:3588] 895 892 890 888 885 ...




-- 
'Raghu'

	[[alternative HTML version deleted]]

