A colleague wrote the following syntax for me:

D = read.csv("x.csv")

## Convert -999 to NA
for (k in 1:dim(D)[2]) {
    I = which(D[,k]==-999)
    if (length(I) > 0) {
        D[I,k] = NA
    }
}

The dataset has many missing values. I am running several regressions on
this dataset, and want to ensure every regression has the same subjects.

Thus I want to drop subjects listwise for dependent variables y1-y9 and
covariates x1-x5 (if data is missing on ANY of these variables, drop
subject).

How would I do this after running the syntax above?

Thank you

        [[alternative HTML version deleted]]

______________________________________________
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