旨在创建一个名为的新列,在应用函数“left”后包含后缀“_left”新DF列研究bd_acct bd_acct_left cc cc_left
与其手动更改名称,我更愿意找到一种自动添加后缀的方法
study <- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
bd_acct <- c(57,66,72,24,76,98,56,32,43,250000,87,34,0,0,67)
cc <- c(1,2,3,5,74,3,5,6,5,3,5,6,7,4,1)
trial_A <- data.frame(study, bd_acct,cc)
left <- function(x, na.rm = FALSE) (quantile(x,0.25) - 1.5*IQR(x))
trial_A %>% mutate_at(c("bd_acct", "cc"), left)
1条答案
按热度按时间zpjtge221#
将
dplyr::mutate
与across()
和.names
参数一起使用:输出: