Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R package does not load dependencies [duplicate]

RESOLVED

In my description file, I changed

Imports: dplyr (>= 0.4.3), ggplot2 (>= 2.1.0), lazyeval (>= 0.1.10)

to

Depends: dplyr (>= 0.4.3), ggplot2 (>= 2.1.0), lazyeval (>= 0.1.10)

This worked for me. "Imports:" may be depreciated?

---

I'm writing a package in RStudio. One of my dependencies is dplyr. When I build and reload the package, I get the following error when running a function:

> library(my_package)
> my_package::get_survey(...)
Error in get_survey(import_dir) : could not find function "%>%"

However, I've documented my dependencies in my DESCRIPTION file:

Imports: dplyr (>= 0.4.3), ggplot2 (>= 2.1.0), lazyeval (>= 0.1.10)

The libraries are installed on my system, however I want my package to work out of the box without requiring users to run

library(dplyr)
library(ggplot2)
library(lazyeval)

before using it. How can I fix this?

Here's my sessionInfo():

R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices
[4] utils     datasets  methods  
[7] base     

other attached packages:
[1] my_package_0.0.0.9000

loaded via a namespace (and not attached):
[1] tools_3.3.0

Thanks in advance for any help!

like image 613
nev Avatar asked Jun 01 '16 12:06

nev


1 Answers

Since there's no answer yet...

J_F writes

Have you tried to put the three packages under "Depends" in your DESCRIPTON?

I ran into this recently and Depends still seems to work where Imports does not.

like image 174
Matt Avatar answered Nov 14 '22 19:11

Matt