简体   繁体   中英

nix-shell with R interpretter and submodules

Can I use R, with required submodules (eg, ggplot2) with nix-shell?

For example, using Python with submodules:

nix-shell -p python34 python34Packages.pandas

However, I can't seem to see how to do the equivalent with R.

nix-shell -p R

Gives me a vanilla R, but what about submodules? I'm not sure I know enough about using nix-shell to evaluate nix expressions, but could this be used from nix-shell as a command?

Note: It is my preference not to pop the expression from the above link in a shell.nix or default.nix . Rather as a single command.

You can pass a nix expression to nix-shell using the -E flag. So the following is valid:

nix-shell -E 'with import <nixpkgs> {}; rWrapper.override {packages = with rPackages; [ggplot2 reshape2];}'

您可以使用与Python示例中相同的方法:

nix-shell -p R rPackages.dplyr rPackages.ggplot2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM