make "k = 100", note that you're doing fcsPar[k]-fcsPar[k+10]
note fcsPar has length 100...
therefore valueDiff becomes NA.. and the if() statement fails.
b
On Jan 6, 2008, at 1:16 AM, Nicholas Crosbie wrote:
>
>
> Can any explain the following error:
>
> Error in if ((seedCount <= seedNumber) && (valueDiff >
> sup)) { :
> missing value where TRUE/FALSE needed
>
> which I get upon running this script:
>
> seedNumber <- 10
> seeds <- array(dim = seedNumber)
> seedCount <- 1
>
> maxValue <- 100
> sup <- maxValue / 2
>
> fcsPar <- array(as.integer(rnorm(100, 50, 10)))
>
> while (seedCount <= seedNumber) {
> for(k in 1:100) {
> valueDiff <- abs(fcsPar[k] - fcsPar[k+1])
> if((seedCount <= seedNumber) && (valueDiff >
> sup)) { #error
> seeds[seedCount] <- fcsPar[k]
> seedCount <- seedCount + 1
> }
> }
> sup <- sup / 2
> }
>
>
> many thanks.
>
>
> Make the switch to the world's best email. Get the new Yahoo!7
> Mail now. www.yahoo7.com.au/worldsbestemail
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.