不知道是不是你要的XD
可使用 dplyr::mutate_each_
library(dplyr)
library(magrittr)
d = data.frame(Column1=sample(1:10,10),
Column2=sample(1:10,10),
Column3=sample(1:10,10),
Column18=sample(20:30,10))
transF = function(x){
return( as.POSIXct(as.numeric(x)*(60*60*24), origin="1899-12-30",
tz="UCT") )
}
## 可自己修改成需要的字段名称 ex: named = c("Column2","Column18")
named = names(d)
d %>% mutate_each_(funs(transF),named)