<quote>
> Error in if (ALLRESULTS[i, 16] <= 0.05) significance_count = significance_count + :
> missing value where TRUE/FALSE needed
>
> The script is included below
>
> it works if i convert the NA values to zero but this is not appropriate as it includes the zero as significant.
>
> ANY SUGGESTIONS
significance.count <- rowSums(ALLRESULTS[,16:22] <= .05, na.rm=TRUE)

?rowSums
</quote>

Good solution.

I would like to comment on the OP's naivete: since he knows that zero is a value of interest to his algorithm, why the heck replace "NA" with zero? In general, if there is some reason not to use na.rm or na.omit, start out by thinking about what NA values mean to your analysis. If they are the equivalent of "FALSE" conditions, then replace them with a numerical value which is "FALSE". In this example, replacing NA with 0.051 would do just fine.

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to