Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
具有R解释程序和子模块的nix shell_R_Nix_Nixos - Fatal编程技术网

具有R解释程序和子模块的nix shell

具有R解释程序和子模块的nix shell,r,nix,nixos,R,Nix,Nixos,我是否可以将R与所需的子模块(如ggplot2)一起与nix shell一起使用 例如,将Python与子模块一起使用: nix-shell -p python34 python34Packages.pandas 然而,我似乎看不出如何用R做等价的事情 nix-shell -p R 给我一个普通的R,但是子模块呢?我不确定我对使用nixshell计算nix表达式了解得不够,但是可以从nixshell作为命令使用吗 注意:我倾向于不在shell.nix或default.nix中从上述链接弹出表

我是否可以将R与所需的子模块(如ggplot2)一起与nix shell一起使用

例如,将Python与子模块一起使用:

nix-shell -p python34 python34Packages.pandas
然而,我似乎看不出如何用R做等价的事情

nix-shell -p R
给我一个普通的R,但是子模块呢?我不确定我对使用nixshell计算nix表达式了解得不够,但是可以从nixshell作为命令使用吗


注意:我倾向于
shell.nix
default.nix
中从上述链接弹出表达式。而是作为单个命令。

您可以使用
-E
标志将nix表达式传递给
nix shell
。因此,以下是有效的:

nix-shell -E 'with import <nixpkgs> {}; rWrapper.override {packages = with rPackages; [ggplot2 reshape2];}'
nix shell-E'与导入{};rWrapper.override{packages=带有rppackages;[ggplot2];}'

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

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

我们确实需要改进nix CLI。虽然上面的方法解决了问题,但它太复杂了。是的,但我也在做一些比平常更复杂的事情。通常您会使用
shell.nix
文件,但我直接启动它是为了在Emacs的组织模式babel中调用
R
命令的替换/包装。nix shell-p R rPackages.dplyr rPackages.ggplot2有什么问题吗?@Alex要简单得多。我看到了链接的文档,并认为这不会起作用。你能把这个作为答案吗?太好了,非常感谢。使用rwraper的文档让我有点困惑。