"run selection as job" is not able to use libraries loaded in session

In a session I load

library(tidyverse)

in the beginning of the script.

Later on if I try to run selected code as job, the following would throw an error, that it can not find function for "%>%":

temp <- data.frame(a = c(1,2,3)) %>%
  filter(a == 2)
print(temp)

Fehler in data.frame(a = c(1, 2, 3)) %>% filter(a == 2) : konnte Funktion "%>%" nicht finden
Ruft auf: sourceWithProgress -> eval -> eval
Ausf�hrung angehalten

This happens also when I select "Run job with copy of global environment".

The simple solution would be to include all required libraries into the selected code, like:

library(tidyverse)
temp <- data.frame(a = c(1,2,3)) %>%
  filter(a == 2)
print(temp)

Did anybody encounter the same problem and did find a more practical way to run selected code as job?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.