Skip to content

Commit

Permalink
Improve code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardlavender committed Jul 17, 2024
1 parent f935730 commit f0ac68b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 41 deletions.
22 changes: 11 additions & 11 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
```

Expand All @@ -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)!
Expand All @@ -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))
```
Expand All @@ -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.
Expand All @@ -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)

Expand All @@ -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()
```

Expand Down
68 changes: 38 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**.

Expand All @@ -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`
Expand All @@ -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.
Expand All @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit f0ac68b

Please sign in to comment.