[R] searching through a matrix

Jessica Higgs jlh599 at psu.edu
Mon Feb 28 00:42:46 CET 2005


I am trying to search through a matrix I have (x) to see if there are any 
missing values. This is what I have been using:

for (i in 1:3455)
    for (j in 1:24)
        if (is.na(x[i,j])) break;

i
j

When I run the program, it either freezes or stops and returns the last 
entry in the matrix (x[3455,24]). I need to figure out what values in my 
data matrix are missing because I am using prcomp and it keeps giving me an 
error starting that there are missing or infinite values in  x. My data 
matrix does have some values that are equal to zero but zero doesn't mean 
that the data is missing. it just indicates that that value is equivalent 
to zero. Any suggestions for how to fix this problem?




More information about the R-help mailing list