从this tutorial开始,我知道管道“将一个语句的输出作为下一条语句的输入。”
我可以选择输出的 并将其作为下一条语句的输入吗? 例如,我想知道此数据集中的异常值:
mtcars$mpg %>% boxplot()$outliers %>% which
谢谢!
答案 0 :(得分:3)
您可以使用purrr::pluck()
mtcars$mpg %>% boxplot() %>% purrr::pluck("out")
根据函数的输出类型,还可以使用[
mtcars$mpg %>% boxplot() %>% .[["out"]]