From f0ac68be184e29a8905e7f06bf3cb8a55ee21ea9 Mon Sep 17 00:00:00 2001 From: edwardlavender Date: Wed, 17 Jul 2024 08:48:43 +0100 Subject: [PATCH] Improve code formatting --- README.Rmd | 22 +++++++++--------- README.md | 68 ++++++++++++++++++++++++++++++------------------------ 2 files changed, 49 insertions(+), 41 deletions(-) diff --git a/README.Rmd b/README.Rmd index 7a4abeb9..c14ae477 100644 --- a/README.Rmd +++ b/README.Rmd @@ -62,7 +62,7 @@ At the time of writing (May 2024), `patter` is more streamlined than [`flapper`] 2. **Install build packages.** Package installation and configuration (may) require the [`devtools`](https://github.com/r-lib/devtools), [`pkgbuild`](https://github.com/r-lib/pkgbuild) and [`here`](https://github.com/r-lib/here) packages. Install them with: -``` +``` r install.packages(c("devtools", "pkgbuild", "here")) ``` @@ -74,18 +74,18 @@ install.packages(c("devtools", "pkgbuild", "here")) 4. **Install [`Julia`](https://julialang.org)**. `Julia` is high-performance programming language that `patter` uses as a backend. If you do not have `Julia` installed on your system, you can install `Julia` via `R` using `JuliaCall`: -``` +``` r # Install the {JuliaCall} package: install.packages("JuliaCall") ``` -``` +``` r # Install `Julia` via {JuliaCall}: library(JuliaCall) julia <- julia_setup(installJulia = TRUE) ``` -``` +``` r # Validate the Julia installation: # * TRUE: `Julia` is working! # * FALSE: `Julia` is not working (see below)! @@ -94,7 +94,7 @@ isTRUE(try(julia_eval('true'), silent = TRUE)) If this doesn't work, download and install `Julia` from [JuliaLang](https://julialang.org/downloads/). Then retry `julia_setup()`: -``` +``` r julia <- julia_setup() isTRUE(try(julia_eval('true'), silent = TRUE)) ``` @@ -113,10 +113,10 @@ The `dependencies = TRUE` argument ensures that suggested packages are also inst To install `patter` from the development (`dev`) branch, use: -``` -remotes::install_github("edwardlavender/patter@dev", - dependencies = TRUE, - build_vignettes = TRUE) +``` r +devtools::install_github("edwardlavender/patter@dev", + dependencies = TRUE, + build_vignettes = TRUE) ``` This branch may include bug fixes and new features but should be used with caution. @@ -125,7 +125,7 @@ We recommend using [`renv`](https://rstudio.github.io/renv/articles/renv.html) ( 6. **Connect to `Julia`**. At the start of every `R` session, you need to connect `R` to `Julia` (and `patter` to [`Patter.jl`](https://github.com/edwardlavender/Patter.jl)): -``` +``` r # Load & attach {patter}: library(patter) @@ -140,7 +140,7 @@ The first time you run `julia_connect()`, it will connect to `Julia` and install 7. **Validate the `R`---`Julia` connection**. To validate that `patter` works on your system, run: -``` +``` r julia_validate() ``` diff --git a/README.md b/README.md index 9cffe465..cccbc492 100644 --- a/README.md +++ b/README.md @@ -102,9 +102,9 @@ touch if you would like to see additional functionality brought into [`pkgbuild`](https://github.com/r-lib/pkgbuild) and [`here`](https://github.com/r-lib/here) packages. Install them with: - - - install.packages(c("devtools", "pkgbuild", "here")) +``` r +install.packages(c("devtools", "pkgbuild", "here")) +``` 3. **Install system libraries**. @@ -123,26 +123,32 @@ touch if you would like to see additional functionality brought into backend. If you do not have `Julia` installed on your system, you can install `Julia` via `R` using `JuliaCall`: - - - # Install the {JuliaCall} package: - install.packages("JuliaCall") +``` r +# Install the {JuliaCall} package: +install.packages("JuliaCall") +``` - # Install `Julia` via {JuliaCall}: - library(JuliaCall) - julia <- julia_setup(installJulia = TRUE) +``` r +# Install `Julia` via {JuliaCall}: +library(JuliaCall) +julia <- julia_setup(installJulia = TRUE) +``` - # Validate the Julia installation: - # * TRUE: `Julia` is working! - # * FALSE: `Julia` is not working (see below)! - isTRUE(try(julia_eval('true'), silent = TRUE)) +``` r +# Validate the Julia installation: +# * TRUE: `Julia` is working! +# * FALSE: `Julia` is not working (see below)! +isTRUE(try(julia_eval('true'), silent = TRUE)) +``` If this doesn’t work, download and install `Julia` from [JuliaLang](https://julialang.org/downloads/). Then retry `julia_setup()`: - julia <- julia_setup() - isTRUE(try(julia_eval('true'), silent = TRUE)) +``` r +julia <- julia_setup() +isTRUE(try(julia_eval('true'), silent = TRUE)) +``` If you run into issues at this stage, it is likely that `Julia` has not been installed properly or `R` can’t find it. You may need to tell `R` @@ -168,9 +174,11 @@ vignettes. This process may take several minutes. Set To install `patter` from the development (`dev`) branch, use: - remotes::install_github("edwardlavender/patter@dev", - dependencies = TRUE, - build_vignettes = TRUE) +``` r +devtools::install_github("edwardlavender/patter@dev", + dependencies = TRUE, + build_vignettes = TRUE) +``` This branch may include bug fixes and new features but should be used with caution. @@ -187,16 +195,16 @@ feedback. to connect `R` to `Julia` (and `patter` to [`Patter.jl`](https://github.com/edwardlavender/Patter.jl)): - - - # Load & attach {patter}: - library(patter) +``` r +# Load & attach {patter}: +library(patter) - # Option (A): Connect to `Julia` using default options: - julia <- julia_connect() +# Option (A): Connect to `Julia` using default options: +julia <- julia_connect() - # Option (B): Connect to `Julia` within an RStudio Project (recommended): - julia <- julia_connect(JULIA_PROJ = here::here("Julia")) +# Option (B): Connect to `Julia` within an RStudio Project (recommended): +julia <- julia_connect(JULIA_PROJ = here::here("Julia")) +``` The first time you run `julia_connect()`, it will connect to `Julia` and install (and pre-compile) @@ -207,9 +215,9 @@ additional `Julia` dependencies. This may take a few minutes. Subsequent 7. **Validate the `R`—`Julia` connection**. To validate that `patter` works on your system, run: - - - julia_validate() +``` r +julia_validate() +``` This should return `NULL`, invisibly, in which case you are good to go. Otherwise, the function will return an error (or `R` may crash). Please