相关疑难解决方法(0)

dplyr:取消选择的列

如何取消选择...自写函数参数中给出的列.(我还需要在另一个点选择列,所以只使用-in 指定列...不能解决我的问题.)

任何解决方案都是apreciated,select-helpers,manipulating quosures或expression,......

# very simple example data
test <- data.frame(a=1:3, b=1:3, c=1:3)

# function skeleton
testfun <- function(x, ...){
  y <- select(x, ...)
  z <- select(x, -...) # does of course not work like this
  return(list(y, z))   # just as an example
}

# calling the function to select different columns
testfun(test, a)
testfun(test, a, b)
Run Code Online (Sandbox Code Playgroud)

r dplyr tidyverse

6
推荐指数
1
解决办法
960
查看次数

标签 统计

dplyr ×1

r ×1

tidyverse ×1