R: Difference between revisions
imported>Krey No edit summary |
imported>Krey No edit summary |
||
Line 13: | Line 13: | ||
in ... | in ... | ||
</syntaxhighlight> | </syntaxhighlight> | ||
and then you can put <code>R-with-my-packages</code> into your <code>environment.systemPackages</code> for a system-wide installation. | and then you can put <code>R-with-my-packages</code> into your <code>environment.systemPackages</code> for a system-wide installation, for instance. | ||
In practice, R is commonly written inside editors like RStudio or inside a Jupyter Notebook. | |||
=== RStudio === | |||
RStudio uses a standard set of packages and ignores any custom R environments, like the one set up above. To install it you can use `rstudioWrapper` just as we used `rWrapper` earlier. | |||
<syntaxhighlight lang="nix> | |||
RStudio-with-my-packages = rstudioWrapper.override{ packages = with rPackages; [ ggplot2 dplyr xts ]; }; | |||
</syntaxhighlight> |
Revision as of 14:18, 13 April 2018
R is a "free software environment for statistical computing and graphics."
Installation
R comes with a very large number of packages, many of which available through nixpkgs. In particular, any package available through CRAN.
Similarly to Python, your packages must be declared when installing R. Commands such as install.packages("ggplot2")
will not work.
To install R with a collection of packages, a new nix package must be defined, for instance
with pkgs;
let
R-with-my-packages = rWrapper.override{ packages = with rPackages; [ ggplot2 dplyr xts ]; };
in ...
and then you can put R-with-my-packages
into your environment.systemPackages
for a system-wide installation, for instance.
In practice, R is commonly written inside editors like RStudio or inside a Jupyter Notebook.
RStudio
RStudio uses a standard set of packages and ignores any custom R environments, like the one set up above. To install it you can use `rstudioWrapper` just as we used `rWrapper` earlier.
RStudio-with-my-packages = rstudioWrapper.override{ packages = with rPackages; [ ggplot2 dplyr xts ]; };