Skip to content

Commit

Permalink
Merge pull request #105 from nhs-r-community/install-python
Browse files Browse the repository at this point in the history
Install python
  • Loading branch information
Lextuga007 authored Apr 20, 2024
2 parents aeed166 + 39400d6 commit b81bb0d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 24 deletions.
1 change: 1 addition & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ book:
- technical-r.qmd
- technical-python.qmd
- technical-git.qmd
- technical-quarto.qmd
- contribution.qmd
- glossary.qmd
page-footer:
Expand Down
9 changes: 7 additions & 2 deletions technical-python.qmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Technical guidance - Python {#tech-python}

## What programs are required
## What programs are required for a computer

To write Python code you will need the [Python program](https://www.python.org/downloads/), an IDE (Integrated Development Environment) like [VSCode](https://code.visualstudio.com/) and Python is supported within [RStudio](https://posit.co/download/rstudio-desktop/) (including in Quarto scripts).

Installing Python will require admin rights for the person installing it.

To check that Python has been installed (on Windows) open the Command Prompt (accessed via the Windows button on the keyboard on a Windows computer) and type `py --version`.

Content to be added, committing this to see if the book renders in GitHub Actions.
23 changes: 23 additions & 0 deletions technical-quarto.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Technical guidance - Quarto {#tech-quarto}

## Quarto

Quarto is the next generation of reporting from R (specifically RMarkdown) that allows for code and text to be used together to produce a wide variety of outputs like word, pdf, PowerPoint, slides, books and websites.
Quarto also allows for more flexibility in use by people who use Python and prefer to use VS Code (or other IDEs).

## Installing for RStudio

The latest version of Quarto is built into the RStudio IDE itself and to update it is necessary to use download the Quarto CLI (command line interface) <https://quarto.org/docs/get-started/>.

::: aside
The Quarto CLI download is a `win.msi` file so may not require authorisation from IT teams to download and install.
:::

The package {quarto} contains functions that can be used in R to run some of the command line commands and isn't necessary to have if you are happy to use the command line or Terminal as it is known as in RStudio.
For example, to preview this book, in the command line the code is:

`quarto render`

but in R using {quarto} it is:

`quarto::quarto_render()`
26 changes: 4 additions & 22 deletions technical-r.qmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Technical guidance - R {#tech-r}

## What programs are required
## What programs are required for a computer

To write R code you will need the [R program](https://cran.r-project.org/bin/windows/base/), an IDE (Integrated Development Environment) like [RStudio](https://posit.co/download/rstudio-desktop/) or [VSCode](https://code.visualstudio.com/) and (for Windows) the [RTools](https://cran.r-project.org/bin/windows/Rtools/) program.

Expand All @@ -10,6 +10,8 @@ Both RStudio and VS Code are more visually friendly graphical user interfaces (G
RTools is used by Windows to build some packages and, although there are sometimes warnings when this isn't installed, it is not always required.
As people in the NHS and other public sector organisations will have to contact IT teams for access to software it is advisable to ask for RTools just in case this is an issue.

Installing these programs will require admin rights for the person installing them.

## Getting R

The link to to the [R program](https://cran.rstudio.com/) has a few links so for Windows select `Download R for Windows`, then the subdirectory `base` which has the same link as `install R for the first time`.
Expand Down Expand Up @@ -51,32 +53,12 @@ This won't happen if only RStudio is updated.
The other approach to updating packages is in a controlled way so as to not break code.
The issue with this is that latest functionality is lost to the analysis and may never be introduced, in case something breaks.

To assist with this there are pipeline packages like [{renv}](https://rstudio.github.io/renv/articles/renv.html) which takes a snapshot of the packages as they are used in code and which can be retained within a project environment so that changes outside don't affect the analysis:
To assist with this there are packages like [{renv}](https://rstudio.github.io/renv/articles/renv.html) which takes a snapshot of the packages as they are used in code and which can be retained within a project environment so that changes outside don't affect the analysis:

> it records the version of R + R packages being used in a project, and provides tools for reinstalling the declared versions of those packages in a project
These snapshots can also be shared with other members of the team who are working on the same project.

## Quarto

Quarto is the next generation of reporting from RMarkdown that allows for code and text to be used together to produce a wide variety of outputs like word, pdf, PowerPoint, slides, books and websites.
Quarto also allows for more flexibility in use by people who use Python and prefer to use VS Code (or other IDEs).

The latest version of Quarto is built into the RStudio IDE itself and to update it is necessary to use download the Quarto CLI (command line interface) https://quarto.org/docs/get-started/.

::: aside
The Quarto CLI download is a `win.msi` file so may not require authorisation from IT teams to download and install.
:::

The package {quarto} contains functions that can be used in R to run some of the command line commands and isn't necessary to have if you are happy to use the command line or Terminal as it is known as in RStudio.
For example, to preview this book, in the command line the code is:

`quarto render`

but in R using {quarto} it is:

`quarto::quarto_render()`

## Updating R from a package

The package {installr} has the function `updateR()` that updates R.
Expand Down

0 comments on commit b81bb0d

Please sign in to comment.