Message-ID: <f5bc463e0809140228k3eba8cd0g6fea7c5eb2d7db8c@mail.gmail.com>
Date: 2008-09-14T09:28:42Z
From: Nicky Chorley
Subject: Where is the error
In-Reply-To: <19477706.post@talk.nabble.com>
2008/9/14 rajivv <rajiv_das at rediffmail.com>:
>
> P <- vector(mode="numeric",length =10)
>
> SS<-function(){for(id in 0:9){
> if(0<P[id])
> print("ss")
> else
> print("ss")
> }}
>
> SS()
> -------------------------------------------------------
> Error in if (0 < P[id]) print("ss") else print("ss") :
> argument is of length zero
Arrays/vectors/matrices in R are indexed from 1, not 0.
Regards,
Nicky Chorley