这(部分y = ...
(运行异常缓慢:
library(dplyr)
n <- 10000
p <- 1000
x <- as.tbl(as.data.frame(matrix(rnorm(n * p), nc = p)))
y = x %>%
select_if(., is.numeric)
事实上,它是我的数据清理代码中最小的部分之一。有没有更好的方法可以做到这一点?
(DPLYR 0.7.1(
尽管更笨重,但运行速度更快:
x %>% select(which(lapply(x,class) == "numeric"))