Skip to content

Commit 3173ab8

Browse files
authored
docs: reorganise documentation and simplify installation guide (#36)
* Fix formatting in README for R code example Fix formatting and removed the python code Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Revise INSTALL.md for clarity and conciseness Updated installation instructions for acro-r, including prerequisites and step-by-step guidance for setting up Python and R environments. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Delete inst/installation.md Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Delete inst/examples.md Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Delete inst/welcome.md Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Delete inst/supports.md Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Update links in _pkgdown.yml to point to articles Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Create examples.Rmd Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Add installation guide for acro package Added a comprehensive installation guide for the acro package, including instructions for CRAN and GitHub installation, prerequisites, initialization, troubleshooting, and verification steps. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Create supports.Rmd Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> * Add welcome documentation for ACRO-R package This document introduces the ACRO-R package, its features, and usage instructions. It also includes acknowledgements and links to relevant resources. Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk> --------- Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk>
1 parent ddb5da0 commit 3173ab8

8 files changed

Lines changed: 155 additions & 266 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ If you are having problems installing the package, please see the more detailed
4040
Before using any function from the package, an acro object should be initialised using the following R code:
4141

4242
``` r
43-
>>> library("acro")
44-
>>> acro_init(suppress = TRUE)
43+
library("acro")
44+
acro_init(suppress = TRUE)
4545
```
4646

4747
### Try Online with MyBinder

_pkgdown.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ navbar:
1414
- text: "Reference"
1515
href: reference/index.html
1616
- text: "Welcome to ACRO-R"
17-
href: welcome.html
17+
href: articles/welcome.html
1818
- text: "What ACRO-R Supports"
19-
href: supports.html
19+
href: articles/supports.html
2020
- text: "Installation"
21-
href: installation.html
21+
href: articles/installation.html
2222
- text: "Examples"
23-
href: examples.html
23+
href: articles/examples.html
2424
right:
2525
- icon: fab-github
2626
href: https://github.com/AI-SDC/ACRO-R

inst/INSTALL.md

Lines changed: 24 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,143 +1,42 @@
11
# Installation Guides
22

3-
This document is intended to provide help installing and running acro-r in different settings.
3+
This document is intended to provide help installing and running acro-r.
44

5-
Keeping this comprehensive will require input from the community.
5+
## Prerequisites
66

7-
So please email sacro.contact@uwe.ac.uk, or [raise an issue on the GitHub repository](https://github.com/AI-SDC/ACRO-R/issues/new/choose) if:
8-
- you have a setting that is not covered, or
9-
- the steps outlined below do not work for you,
7+
- **Python 3.10+**: You must have Python installed on your system.
8+
- **R**: You need a working installation of R.
109

11-
**Please note**: most of the scenarios below assume that
12-
- you have a working version of Python 3 (version 3.9 or higher) on your system
13-
- you are able to access a terminal or command prompt to write and execute some commands.
10+
## Installation
1411

15-
---
12+
### Step 1: Install the R package
1613

17-
## Step 1 create a python virtual environment and install the base python package *acro*
18-
**In every case** we recommend that you create what is called a 'python virtual environment' called **r-acro**.
19-
Virtual environments (*venv's*) are recommended best practice.
20-
This is because they isolate the impact of any changes you make in one venv - such as adding or updating a package- from the rest of your system.
14+
Install the **acro** package from CRAN:
2115

22-
There are many tutorials available on the web if you get stuck.
23-
We do not endorse any particular site, but here are some examples:
24-
- [an overview with examples for windows/linux/mac](https://python.land/virtual-environments/virtualenv)
25-
- [another that also contains instructions for VSCode and Pycharm](https://realpython.com/python-virtual-environments-a-primer/)
26-
27-
**For individual users** we suggest that you do this in your home directory where you should have write permission.
28-
29-
**To install site-wide** we assume you have access rights and know where your organisation's preferred locations are (for example, this might be ```/usr/local``` on a linux system).
30-
31-
### Make a dedicated virtual environment
32-
You can make a new virtual environment via:
33-
- the Anaconda GUI interface to the conda system
34-
- command line access - by opening a terminal or command prompt and entering the command:
35-
```sh
36-
conda create --n r-acro
37-
```
38-
if you have a version of conda installed or
39-
```sh
40-
python -m venv ./r-acro
41-
```
42-
to use the native python *venv* package.
43-
44-
### Change to that virtual environment and install acro
45-
Anaconda comes with its own GUI to makes this process easy.
46-
47-
**On any system** using *conda* from the command line :
48-
```sh
49-
conda activate r-acro
50-
conda install conda-forge::acro
51-
52-
#assuming this completes successfully you can now exit
53-
conda deactivate r-acro
54-
```
55-
56-
**On Windows**from the command line with python's *pip* package manager:
57-
```sh
58-
# In cmd.exe
59-
r-acro\Scripts\activate.bat
60-
# In PowerShell
61-
r-acro\Scripts\Activate.ps1
62-
```
63-
followed by
64-
```sh
65-
python -m pip install acro
66-
#assuming this completes successfully you can now exit the virtual environment
67-
deactivate
68-
```
69-
70-
**On linux/mac** using conda:
71-
72-
```sh
73-
source r-acro/bin/activate
74-
#you should see the your command prompt change to show (r-acro)
75-
python -m pip install acro
76-
#assuming this completes successfully you can now exit the virtual environment
77-
deactivate
78-
```
79-
---
80-
81-
## Step 2 Install the R packages *reticulate* and *acro*
82-
83-
The *reticulate* package is the industry-standard method for supporting communications between R and Python.
84-
It provides the `plumbing` between the R `front-end'
85-
86-
These commands should work whether you are
87-
- working on a machine outside the TRE: in which case packages should install from a mirror of the CRAN service
88-
- working on a machine inside a TRE: in which case the administrator should have set up a local mirror of approved packages from CRAN
89-
90-
**For individual users** without permission to make site-wide or machine-wide changes
91-
Open your preferred R interface - for example, RStudio, and in a R window type
92-
```R
93-
install.packages*("reticulate")
16+
```r
9417
install.packages("acro")
9518
```
9619

97-
**For administrators wishing to install for all users site-wide** the commands are the same but you will need to run them in *sudo* mode.
98-
99-
---
100-
101-
## Step 3: Telling R and reticulate to use the new python virtual environment
102-
The final step of the process is to tell the R package reticulate which version of python to use.
103-
104-
What we need to do is to set the value of a global variable ```RETICULATE_PYTHON```
105-
The [R documentation for doing this](https://rstudio.github.io/reticulate/articles/versions.html) is a little inconsistent here, but the following options all seem to work.
20+
### Step 2: Initialize ACRO
10621

107-
### Option 1- For individuals using RStudio
108-
If you follow the menu items from ```Tools->Project Options ->Python``` or ```Tools->Global Options->Python``` you can tell it to use the version of python from the virtual environment you create in step 1, either for a specific R project or for all your sessions as shown below
22+
The `acro` package interfaces with the Python `acro` library. The package provides a helper function to set up the necessary Python environment and dependencies automatically.
10923

110-
![This is what it looks like: step0](./images/settingpython-rstudio-step0.png)
24+
Run the following in your R console:
11125

112-
![This is what it looks like: step1](./images/settingpython-rstudio-step1.png)
113-
114-
![This is what it looks like: step2](./images/settingpython-rstudio-step2.png)
115-
116-
![This is what it looks like: step3](./images/settingpython-rstudio-step3.png)
117-
118-
### Option 2 - Adding code to an individual project file
119-
you add add one of the following lines at the start of your file
120-
```R
121-
#Either
122-
use_python("~/r-acro/bin/python")
123-
#or
124-
use_virtualenv("~/r-acro")
125-
#or
126-
use_condaenv("r-acro")
127-
#finally followed by
128-
library(reticulate)
129-
library("acro)"
130-
```
131-
132-
### Option 3 - Editing your personal R preferences
133-
In your home directory create (or edit) the file ```.Rprofile``` file, adding the lines
134-
135-
```R
136-
Sys.setenv(RETICULATE_PYTHON=file.path(Sys.getenv("USERPROFILE"),"r-acro/bin/python"))
137-
Sys.setenv(RETICULATE_PYTHON_ENV=file.path(Sys.getenv("USERPROFILE"),"r-acro"))
26+
```r
27+
library("acro")
28+
acro_init()
13829
```
13930

31+
This command will:
32+
1. Check for a valid Python installation.
33+
2. Create a virtual environment named `r-acro`.
34+
3. Install the required Python `acro` package into this environment.
35+
36+
Once initialized, you are ready to use ACRO-R!
14037

38+
## Troubleshooting
14139

142-
### Option 4- Making site-wide changes
143-
You can also edit the [site-wide Rprofile]() file to add these global environment variables, using replacing *~/r-acro* with the path to wherever you created the dedicated virtual environment.
40+
If you encounter issues during `acro_init()`:
41+
- Ensure Python 3.10+ is installed and added to your system PATH.
42+
- If you are on a restricted network, you may need to configure proxy settings for Python package installation.

inst/supports.md

Lines changed: 0 additions & 123 deletions
This file was deleted.
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
---
2+
title: "Examples"
3+
---
4+
15
# Examples
26

37
## Interactive Notebook
48

59
For comprehensive examples and tutorials, see our interactive R notebook:
610

7-
[Example Notebook](articles/example-notebook.html)
11+
[Example Notebook](example-notebook.html)
812

913
## Quick Start Examples
1014

@@ -37,4 +41,4 @@ print(result)
3741
acro_finalise()
3842
```
3943

40-
For more detailed examples and use cases, please refer to the [Example Notebook](articles/example-notebook.html).
44+
For more detailed examples and use cases, please refer to the [Example Notebook](example-notebook.html).
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: "Installation Guide"
3+
---
4+
15
# Installation Guide
26

37
## Install from CRAN
@@ -24,19 +28,22 @@ devtools::install_github("AI-SDC/ACRO-R")
2428

2529
ACRO-R requires:
2630
- R version 4.0 or higher
27-
- Python 3.10+ or higher with the ACRO Python package installed
31+
- Python 3.10+ or higher
2832

29-
## Python ACRO Installation
33+
## Initialization
3034

31-
The R package interfaces with the Python ACRO library. Install it using:
35+
The package interfaces with the Python ACRO library. Use `acro_init()` to automatically handle the Python environment setup:
3236

33-
```bash
34-
pip install acro
37+
```r
38+
library("acro")
39+
acro_init(suppress = TRUE)
3540
```
3641

42+
This will create a virtual environment and install the required Python packages if they are missing.
43+
3744
## Troubleshooting
3845

39-
If you are having problems installing the package, please see the more detailed [installation guide](INSTALL.md) or check the [GitHub issues](https://github.com/AI-SDC/ACRO-R/issues).
46+
If you are having problems installing the package, please see the simplified steps above or check the [GitHub issues](https://github.com/AI-SDC/ACRO-R/issues).
4047

4148
## Verification
4249

0 commit comments

Comments
 (0)