Add an "Install an R package from source" section.
DHCP (talk | contribs)
m prefix shell command with "$"; fix formatting
 
(One intermediate revision by one other user not shown)
Line 14: Line 14:
If you with to use `nix-shell` to generate an on-the-fly environment with some R packages, the command is similar:
If you with to use `nix-shell` to generate an on-the-fly environment with some R packages, the command is similar:


<syntaxhighlight lang="sh">
<syntaxhighlight lang="console">
nix-shell --packages 'rWrapper.override{packages = [ rPackages.ggplot2 ];}'
$ nix-shell --packages 'rWrapper.override{packages = [ rPackages.ggplot2 ];}'
</syntaxhighlight>
</syntaxhighlight>


Line 199: Line 199:
To knit a .Rmd file to a pdf (or .Rnw), you need to have included in your envronment <code> pkgs.texlive.combined.scheme-full</code>as well as <code> pandoc </code> or it will fail to knit. None of the other texlive packages contain the proper "frame" package. Note there are likely other workarounds but this requires the least effort.
To knit a .Rmd file to a pdf (or .Rnw), you need to have included in your envronment <code> pkgs.texlive.combined.scheme-full</code>as well as <code> pandoc </code> or it will fail to knit. None of the other texlive packages contain the proper "frame" package. Note there are likely other workarounds but this requires the least effort.


If <code>R</code> is included (using wrapper) but <code>pandoc</code> is not wanted in the user environment, one can expose it just for the R with
<syntaxhighlight lang="nix">
(rWrapper.override{
  packages = with rPackages; [
    markdown
    # other plugins go also here
  ];
}).overrideAttrs (old: {
  buildInputs = (old.buildInputs or []) ++ [
    pkgs.pandoc
  ];
});
</syntaxhighlight>
== Other Editors ==
== Other Editors ==


Line 214: Line 227:
When the R package "officer" has been installed from the Nix package manager, "save_as_docx" does not work:
When the R package "officer" has been installed from the Nix package manager, "save_as_docx" does not work:


<pre>
Error in write_xml.xml_document(private$doc, file = private$filename) :  
Error in write_xml.xml_document(private$doc, file = private$filename) :  
Error closing file
Error closing file
Line 222: Line 236:
2: In write_xml.xml_document(private$doc, file = private$filename) :
2: In write_xml.xml_document(private$doc, file = private$filename) :
Permission denie [1501]
Permission denie [1501]
</pre>


However officer does work if installed using the conventional install.packages() which can be enabled as discussed in
However officer does work if installed using the conventional install.packages() which can be enabled as discussed in