. rle y, 1:length(column), Inf, y . , - 1.
keep <- c(date = T, apply(dat[, -1], 2,
function(x) {
y <- 1:length(x)
y[!is.finite(x)] <- 0
return(!any(rle(y)$lengths > 1))
}))
dat2 <- dat[, keep]
dat2
, "X" read.table.
, dput :
dat <- structure(list(date = c("2012-07-02", "2012-07-03", "2012-07-05",
"2012-07-06", "2012-07-09"), X10104 = c(0.003199, 0.005873, Inf,
Inf, -0.002742), X10107 = c(Inf, 0.006545, -0.001951, -0.016775,
-0.006129), X10138 = c(0.001112, 0.001428, -0.01109, -0.009612,
-0.001294), X10145 = c(-0.012178, Inf, Inf, Inf, 0.00583)), .Names = c("date",
"X10104", "X10107", "X10138", "X10145"), class = "data.frame", row.names = c(NA,
-5L))