2016-08-09 59 views

回答

0

或許我們可以用na.aggregate

library(zoo) 
df1[4:8] <- lapply(df1[4:8], na.aggregate) 

如果我們需要它基於行,請使用applyMARGIN = 1

df1[4:8] <- t(apply(df1[4:8], 1, na.aggregate))