I would assume that valsum is of zero length:
> valsum <- numeric(0)
> str(valsum)
num(0)> if (valsum == 1) 1
Error in if (valsum == 1) 1 : argument is of length zero
check your objects with 'str'
On Thu, May 28, 2009 at 6:39 PM, Derek Lacoursiere
<Derek.Lacoursiere@ufv.ca> wrote:
> Hi,
>
> I have the following:
>
> for(j in (y.raw+1):(rownum-1)){
> valsum<-tstfframed[min.x,j]+tstfframed[min.x,j+1]
> if(valsum == 1){
> cat("valsum loop")
> int.num<-int.num+1
> }
>
> }
>
> but I get the error message: "Error in if (valsum == 1) { : argument
is of
> length zero". I checked whether to see if all the stated variables
have
> associated values (and are not NAs) and every variable (even valsum!) has a
> value. I have no idea where my error is. Can you help me?
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
>
http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?
[[alternative HTML version deleted]]