R Contribution Workflow
1. Example Contribution Workflow using the R Dev Container:
-
To start working in R we will click on
R:(not attach)
which is in the bottom right of the VSCode window. This will open an R terminal for us. -
We can now run R commands. We will use the
utils::askYesNo()
function as an example
2. Editing Source Code
- Edit the source code of
utils::askYesNo()
to change the default options. The source code can be found in$TOP_SRCDIR/src/library/utils/R/askYesNo.R
. - You can redirect to that file using
> Before edit:
askYesNo.R | |
---|---|
> With edit (for example - change to whatever you like!):
askYesNo.R | |
---|---|
3. Rebuild R
- We can re-build R with our changes. Since we have only modified the utils package, rebuilding R will only re-build the utils package.
- First we need to be inside $BUILDDIR.
- Quit R with
q()
or by closing the R terminal. - In the bash terminal, change to the build directory:
- Now run the
make
command to rebuild R with the changes you made in step 2. This will be much faster than the full build!
-
Optionally run
make check
to run R's test suite with your local changes. You may skip this step while you are iterating on a bug fix or other development, until you are ready to create a patch. -
To use the re-built R, simply open a new R terminal.
4. Cross check and Re-running Code
- Check the edit has worked as expected by re-running the example code: