似乎magrittr%>%
包中的功能不适用于该功能。这是我重现我的问题的最小示例。load()
## Create two example variables and save to tempdir()
a <- 1
b <- 1
save(list = ls(), file = file.path(tempdir(), 'tmp.RData'))
## Remove all variables and load into global environment
# rm(list = ls())
load(file.path(tempdir(), 'tmp.RData'))
ls()
# [1] "a" "b"
# Write the same code with pipe "%>%", but not variable is loaded
# rm(list =ls())
library(magrittr)
tempdir() %>% file.path('tmp.RData') %>% load
ls()
# character(0)
我不明白为什么管道不起作用load()
。感谢您的任何建议。