Pipe im Paket magrittr funktioniert nicht für die Funktion load ()
Es scheinte%>%
in dem magrittr package funktioniert nicht für die Funktionload()
. Dies ist mein minimales Beispiel, um meine Frage zu reproduzieren.
## 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)
Ich verstehe nicht, warum die Pipe nicht funktioniert fürload()
. Vielen Dank für alle Vorschläge.