English · PDF 293
magrittr 中还有一些其他有用的工具,你可能会想尝试一下:
为了解决这个问题,你可以使用 "tee" 管道。%T>% 的作用类似于 %>%,区别在于它返回的是左侧而不是右侧的结果。它被称为 "tee",因为它就像一个字面意义上的 T 形管道:
rnorm(100) %>% matrix(ncol = 2) %>% plot() %>% str() #> NULL

rnorm(100) %>% matrix(ncol = 2) %T>% plot() %>% str() #> num [1:50, 1:2] -0.387 -0.785 -1.057 -0.796 -1.756 ...
