【发布时间】:2020-01-04 10:12:16
【问题描述】:
我有这个功能:
coeff_var <- function(data_stand) {
percvar <- (sd(data_stand)/mean(data_stand)*100)
return(percvar)
}
and I want to calculate multiple columns at a time. I have tried:
lapply(data_stand, coeff_var(data_stand))
apply(data_stand,2, coeff_var(data_stand))
summarise(data, data_coeff_var = coeff_var(data_stand))
我也尝试先取消列出该对象:
as.numeric(unlist(data_stand))
我收到以下错误:
is.data.frame(x) 中的错误: (list) 对象不能被强制输入'double'
data_stand 看起来像这样
【问题讨论】: