Hi everyone,
I posted something similar to this in reply to another post, but there seems
to be a problem getting it onto the board, so I'm starting a new post.
I am trying to use conditional formatting to select non-zero and non-NaN
values from a matrix and pass them into another matrix. The problem is that
I keep encountering an error message indicating the ":missing value where
TRUE/FALSE needed "
My code is as follows:
##Code Start
mat_zeroless<-matrix(NA,5000,2000) #generating holding matrix
##Assume source matrix containing combination of values, NaNs and zeros##
for (j in 1:5000)
{
for (k in 1:2000)
{
if(mat[j,k]!=0 & !is.NaN(mat[j,k])) {mat_zeroless[j,k]<-mat[j,k]}
}
}
##Code End
Error in if (mat[j,k] !=0 & !is.NaN(mat[j,k])) { :missing value where
TRUE/FALSE needed
I'm not sure how to resolve this.
rcoder
--
View this message in context:
http://www.nabble.com/missing-TRUE-FALSE-error-in-conditional-construct-tp18972244p18972244.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
[email protected] 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.