Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command to install and load packages #196

Closed
GitHunter0 opened this issue Sep 3, 2020 · 5 comments
Closed

Command to install and load packages #196

GitHunter0 opened this issue Sep 3, 2020 · 5 comments

Comments

@GitHunter0
Copy link

Cool package. One very useful addition would be to have a command similar to pacman::p_load() to load packages after installation (if necessary). Do you guys plan to add that?

@gaborcsardi
Copy link
Member

Loading the package is a very different operation from installing it, it is better not to mix the two, so we won't add that.

@holgerbrandl
Copy link

Clearly, it's different operations, but it's the most typical workflow in the beginning of most R scripts: check if a package is locally installed, install it if not, and load it subsequently. So in this regard p_load serves a very common need. I struggle to envision use cases where one may not want to load a package that was just installed.

@gaborcsardi
Copy link
Member

I don't doubt that people want this kind of function, there is plenty of p_load() use on GitHub. Although, if they are happy with p_load(), then I am not sure if we need another implementation of the same thing in pak.

@gaborcsardi
Copy link
Member

For the record, p_load() has a lot of issues so if we'll ever have a function that you'd call at the top of scripts to install & load the required packages, it would work somewhat differently.

Most importantly, it would be nice if

pak::script_init_lib(c("user/repo", "pkg1", "pkg2"))

could ensure that the required versions are installed, i.e. user/repo from GitHub, and pkg1 and pkg2 from some CRAN-like repo.

(The script_init_lib() name is temporary.)

Plus possibly, it could

  • check if these packages are already loaded, and warn/error if the wrong versions are loaded,
  • optionally install the packages into a local library and load them from there,
  • optionally print a nice package version table.

Anything else?

@holgerbrandl
Copy link

Thank you for looking into the idea.

Regarding the question about the need for another implementation. https://github.com/trinker/pacman has not been touched for 4 years, so the clock is clicking until it fails to work. That's why I got curious about pak in the first place.

Regarding your requirements analysis, I've never looked under the hood of p_load and I can't contribute anything substantial here. I feel that p_load is more important than p_load_gh since most packages are released on cran or similar, but 1 out 10 packages comes directly from github in my experience so p_load_gh
would be also important for consistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants