How can I remove columns with NaN entries ?

Here is my simple example:

> data <- read.csv("test.csv")
> xdata <- data[3:length(data)]
> xs <- lapply(xdata, function(x){(x - mean(x))/sqrt(var(x))})
> x <- data.frame(xs)
> x
                   C     D               E                F
1 -0.7071068 NaN -0.7071068 -0.7071068
2  0.7071068 NaN  0.7071068  0.7071068

I am sure it is possible to remove column D (with NaN's) in some simple 
fashion, using is.nan function
without explicitly looping through, and I am sure I was able to do it in 
the past, but I cannot recall how.

Your help will be greatly appreciated.

Ryszard

        [[alternative HTML version deleted]]

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to