How to use names from a different package inside a module?
EKtheSage opened this issue · comments
EKtheSage commented
Error description
Hi,
I just started learning about box
, so I may not know the right way to use it yet. I ran into this error the other day, hopefully you can show me how to do it.
I wrote a test function in test.R
script in the R folder in my project
test <- function(dat) {
dat %>%
filter(x == 3)
dat
}
In a separate file, I called the function using box:
box::use(
R/test[test],
dplyr[...]
)
In search()
I can see both dplyr and test.R in the environment:
> search()
[1] ".GlobalEnv" "mod:dplyr" "mod:R/test" "tools:rstudio" "package:stats"
[6] "package:graphics" "package:grDevices" "package:utils" "package:datasets" "package:methods"
[11] "Autoloads" "org:r-lib" "package:base"
But if I call test(mtcars)
it resulted in the following error:
> test(mtcars)
Error in dat %>% filter(x == 3) : could not find function "%>%"
R version
> R.version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 4
minor 1.2
year 2021
month 11
day 01
svn rev 81115
language R
version.string R version 4.1.2 (2021-11-01)
nickname Bird Hippie
‘box’ version
1.1.2