终于看到了这个函数:
dplyr::between(x, 0, 10)
## implemented efficiently in C++ for local values, and translated to the appropriate SQL for remote tables.
microbenchmark(a[a <= 1 & a >= -1], a[between(a, -1, 1)], times = 30)
Unit: milliseconds
expr min lq mean median uq max neval
a[a <= 1 & a >= -1] 723.4022 997.9427 1128.8773 1152.6774 1287.4322 1609.2269 30
a[between(a, -1, 1)] 446.1393 613.3167 661.3596 654.2762 732.8539 940.2801 30