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

Feature/r devtools #374

Merged
merged 27 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3176c9a
ADD: create r_devtools.rst
WouterVanAssche Nov 29, 2023
2d3ae3f
ADD: r-package-management anchor
Dec 5, 2023
925c811
Fix typo in anchor
Dec 5, 2023
216d5d6
ENH: update r_devtools and include links
Dec 5, 2023
01235b5
FIX: typo in anchor
WouterVanAssche Dec 6, 2023
6f220d8
ADD: add r_devtools to toctree
WouterVanAssche Dec 6, 2023
83f2292
FIX: add anchor, update title and minor fixes
WouterVanAssche Dec 6, 2023
87f70a6
Update devtools url
WouterVanAssche Dec 7, 2023
67e6d5b
Update source/software/r_devtools.rst
WouterVanAssche Dec 7, 2023
393a279
Update source/software/r_devtools.rst
WouterVanAssche Dec 7, 2023
ff898ee
add r_devtools reference to r_package_management.rst
WouterVanAssche Dec 7, 2023
ac6e575
update code-block style
WouterVanAssche Dec 7, 2023
b89778f
update paragraph local R library
WouterVanAssche Dec 7, 2023
f07a6b5
update references to R package management
WouterVanAssche Dec 7, 2023
52c466c
add note on devtools version
WouterVanAssche Dec 7, 2023
035948e
add note on devtools missing in -bare R modules
WouterVanAssche Dec 7, 2023
03580c5
move r_devtools in toctree under Software development
WouterVanAssche Dec 7, 2023
eb835d5
fix brokel url to conda documentation
WouterVanAssche Dec 7, 2023
e0abc1a
Update source/software/r_devtools.rst
WouterVanAssche Dec 12, 2023
1978063
Update source/software/r_devtools.rst
WouterVanAssche Dec 12, 2023
3fc737c
Update source/software/r_devtools.rst
WouterVanAssche Dec 12, 2023
9bd8c7a
FIX: or -> and
WouterVanAssche Dec 19, 2023
ceaa4bf
STY: included suggested changes
WouterVanAssche Dec 19, 2023
f8a1e1d
STY: rephrase introduction
WouterVanAssche Dec 19, 2023
2027554
STY: reformat to propper note
WouterVanAssche Dec 19, 2023
d2e3d07
STY: R installing packages with... -> installing R packages with...
WouterVanAssche Dec 19, 2023
e02fd0d
fix capital
WouterVanAssche Dec 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions source/software/r_devtools.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.. _r_devtools:

R installing packages with devtools
WouterVanAssche marked this conversation as resolved.
Show resolved Hide resolved
===================================

Introduction
~~~~~~~~~~~~

The installation of some R packages may require the use of devtools.
WouterVanAssche marked this conversation as resolved.
Show resolved Hide resolved
Devtools is an R package that facilitates the installation of other
WouterVanAssche marked this conversation as resolved.
Show resolved Hide resolved
R packages from github, gitlab, bitbucket or other repositories.
In what follows github will be used as an example, please consult the
WouterVanAssche marked this conversation as resolved.
Show resolved Hide resolved
devtools_ documentation for examples of other repositories.

Depending on how your R library is managed, you will need a slightly different
approach to use or install devtools.
WouterVanAssche marked this conversation as resolved.
Show resolved Hide resolved

.. note::

When consulting the devtools documentation, make sure that it is the correct version!
It should match the module devtools version. To check what devtools version is installed:
WouterVanAssche marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: r

library(devtools)
sessioninfo::session_info()

Installing in a local R library
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you manage your R packages in a :ref:`local R library<r_package_management_standard_lib>` under ``$VSC_DATA/R``
while using a centrally installed R module, you can use the devtools package included in the module.
WouterVanAssche marked this conversation as resolved.
Show resolved Hide resolved
You will need to execute the following commands in the R console:

.. code-block:: r

> # First check that the R library path points to your personal R library:
WouterVanAssche marked this conversation as resolved.
Show resolved Hide resolved
> .libPaths()
> # Set the R library path if this was is the case.
WouterVanAssche marked this conversation as resolved.
Show resolved Hide resolved
> .libPaths("/data/leuven/XXX/vscXXXXX/R/")
> # Load devtools and e.g. install your package from github:
> library(devtools)
> devtools::install_github("Developer/Package")

Installing in a conda environment
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you are using conda to manage your R packages, you should first install
devtools in your conda environment. The following steps assume that you
already have a conda environment named "science". If you do not yet have
a conda environment, First create a :ref:`conda environment<r_package_management_conda>`.

.. code-block:: bash

$ # Activate your conda environment and install devtools
$ source activate science
$ conda install -c conda-forge r-devtools
$ # Launch R
$ R

WouterVanAssche marked this conversation as resolved.
Show resolved Hide resolved
.. code-block:: r

> # Check that the R library path points to your conda R library
> .libPaths()
> # Set the R library path if this was not the case.
> .libPaths("/data/leuven/XXX/vscXXXXX/miniconda3/envs/science/lib/R/library")
> # Load devtools and e.g. install your package from github:
> library(devtools)
> devtools::install_github("Developer/Package")

.. _devtools: https://www.rdocumentation.org/packages/devtools
8 changes: 8 additions & 0 deletions source/software/r_package_management.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _R_package_management:

R package management
MaximeVdB marked this conversation as resolved.
Show resolved Hide resolved
====================

Expand All @@ -12,6 +14,8 @@ very easy for a user to install them just for himself, or for his
research group, that is not a problem though. Do not hesitate to contact
WouterVanAssche marked this conversation as resolved.
Show resolved Hide resolved
support whenever you encounter trouble doing so.

.. _r_package_management_standard_lib:

Standard R package installation
-------------------------------

Expand Down Expand Up @@ -48,6 +52,8 @@ library, .e.g., ::
Note that R packages often depend on the specific R version they were installed
WouterVanAssche marked this conversation as resolved.
Show resolved Hide resolved
for, so you may need to reinstall them for other versions of R.

.. _r_package_management_conda:

Installing R packages using conda
---------------------------------

Expand Down Expand Up @@ -177,3 +183,5 @@ More information
~~~~~~~~~~~~~~~~

Additional information about conda can be found on its `documentation site <https://conda.readthedocs.io/en/latest/>`__.
WouterVanAssche marked this conversation as resolved.
Show resolved Hide resolved

For installing R packages from github or other repositories see also :ref:`R devtools<r_devtools>`:
1 change: 1 addition & 0 deletions source/software/using_software.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ R
.. toctree::
:maxdepth: 2

r_devtools
WouterVanAssche marked this conversation as resolved.
Show resolved Hide resolved
r_command_line_arguments_in_scripts
r_integrating_c_functions

Expand Down