Hi All,

I have a data frame which has columns comprised mainly of "NA"s.  I know
there are functions na.pass and na.omit etc which can be used in these
situations however I can't them to work in this case.  I have a function
which returns the data according to some rule i.e. removal of N in this
code:

nep <- function(data)
    {
    dummy <- rep(0,378)
    for(i in 1:378){
    if(is.na(data$with.Wcode)[i])
    data$with.Wcode[i] <- "O"
    }
    for(i in 1:378){
    if(data$with.Wcode[i]=="N")
    dummy[i] <- i
    }
    return(data[-dummy,])
    }

However, I really don't want to replace the NAs with "O".  I'd just like to
gloss over them.  I can't just delete them because the structure of the data
frame needs to be maintained.  Can anyone suggest how I can write in a line
or two to ignore the NAs instead of replacing them?  I've tried this code
but it doesn't work!

nep <- function(data)
    {
    dummy <- rep(0,378)
    for(i in 1:378){
    na.pass(data$with.Wcode[i])
    if(data$with.Wcode[i]=="N")
    dummy[i] <- i
    }
    return(data[-dummy,])
    }


Thank you,

Laura

	[[alternative HTML version deleted]]

