Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nanxstats/r-windows-paths

R command-line tool paths on Windows systems
https://github.com/nanxstats/r-windows-paths

command-line pandoc quarto r rtools tinytex windows

Last synced: 16 days ago
JSON representation

R command-line tool paths on Windows systems

Awesome Lists containing this project

README

        

---
output: github_document
# To center the elements correctly on GitHub, we need to post-process
#

blocks to remove blank lines after

and add two leading spaces
# before each tag.
knit: |
(function(inputFile, encoding) {
rmarkdown::render(input = inputFile, encoding = encoding)
output <- paste0(basename(tools::file_path_sans_ext(inputFile)), ".md")
content <- paste0(readLines(output), collapse = "\n")

matches <- gregexpr("(?s)

]*>.*?

", content, perl = TRUE)
match_texts <- regmatches(content, matches)[[1]]
process_p_block <- function(block) {
block <- gsub("(

]*>)[ \\t]*\\n([ \\t]*\\n)*", "\\\\1\n", block)
block <- gsub("(
]*>)", " \\\\1", block)
block
}
modified_texts <- vapply(match_texts, process_p_block, character(1))
regmatches(content, matches)[[1]] <- modified_texts

writeLines(content, con = output)
invisible(output)
})
---

```{r, include=FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
echo = FALSE
)
```

# r-windows-paths


r-windows-paths



Example versions ·
Configure and verify


R ·
Rtools ·
TinyTeX ·
MiKTeX ·
Pandoc ·
Quarto ·
Git

Essential R command-line tool paths on Windows.
This information can help setting up the `PATH` environment variable
for seamless command-line access.

## Example versions

Some of the paths below are specific to the installed software version.
We use these software version examples:

```{r}
str_extract_first <- function(x, pattern) {
m <- regexec(pattern, text = x, perl = TRUE)
regmatches(x, m = m)[[1]][2]
}

get_r_version <- function() {
"http://cran.r-project.org/src/base/VERSION-INFO.dcf" |>
url() |>
read.dcf() |>
as.data.frame() |>
getElement(name = "Release")
}

get_rtools_version <- function() {
version_string <- "https://raw.githubusercontent.com/r-windows/rtools-chocolatey/master/src/rtools.nuspec" |>
curl::curl_fetch_memory() |>
getElement(name = "content") |>
rawToChar() |>
str_extract_first(pattern = "(.*?)")

parts <- strsplit(version_string, "\\.")[[1]]
paste0(parts[1], parts[2])
}

get_rstudio_version <- function() {
version_string <- "http://download1.rstudio.org/current.ver" |>
curl::curl_fetch_memory() |>
getElement(name = "content") |>
rawToChar()

parts <- strsplit(trimws(version_string), "\\+")[[1]]
major <- parts[1]
minor <- strsplit(parts[2], "\\.")[[1]][1]
list(major = major, minor = minor)
}

r_version <- get_r_version()
rtools_version <- get_rtools_version()
rstudio_version <- get_rstudio_version()
rstudio_version_major <- rstudio_version$major
rstudio_version_minor <- rstudio_version$minor
```

- R `r r_version`
- Rtools`r rtools_version`
- RStudio Desktop `r sprintf("%s+%s", rstudio_version_major, rstudio_version_minor)`

## Key paths

### R

`R.exe` and `Rscript.exe` for running `R CMD build` and `R CMD check`.

R release version `r r_version`:

```batchfile
C:\Program Files\R\R-`r r_version`\bin
```

R-devel:

```batchfile
C:\Program Files\R\R-devel\bin
```

### Rtools

C/C++/Fortran toolchain for building R and R packages from source.

Contains `gcc`, `g++`, `gfortran`:

```batchfile
C:\rtools`r rtools_version`\x86_64-w64-mingw32.static.posix\bin
```

Contains Texinfo (`texi2dvi`, `texi2pdf`) required by `R CMD check`,
and GNU Make (`make`) required for building R from source:

```batchfile
C:\rtools`r rtools_version`\usr\bin
```

### TinyTeX

TeX distribution binaries for LaTeX support.

Contains `pdflatex` required by `R CMD check` and for building R from source.

```batchfile
C:\Users\%USERNAME%\AppData\Roaming\TinyTeX\bin\windows
```

### MiKTeX

TeX distribution binaries for LaTeX support.

Contains `pdflatex` required by `R CMD check` and for building R from source.

MiKTeX installed via `choco install miktex` or standalone installer (all users):

```batchfile
C:\Program Files\MiKTeX\miktex\bin\x64
```

MiKTeX installed via standalone installer (current user):

```batchfile
C:\Users\%USERNAME%\AppData\Local\Programs\MiKTeX\miktex\bin\x64
```

### Pandoc

pandoc installed via `choco install pandoc` or standalone installer:

```batchfile
C:\Users\%USERNAME%\AppData\Local\Pandoc
```

pandoc distributed with RStudio Desktop (installer):

```batchfile
C:\Program Files\RStudio\resources\app\bin\quarto\bin\tools
```

pandoc distributed with RStudio Desktop (zip):

```batchfile
C:\Users\%USERNAME%\RStudio-`r sprintf("%s-%s", rstudio_version_major, rstudio_version_minor)`\resources\app\bin\quarto\bin\tools
```

pandoc distributed with Quarto installed via `choco install quarto`:

```batchfile
C:\ProgramData\chocolatey\lib\quarto\tools\bin\tools
```

pandoc distributed with Quarto installed via Quarto standalone installer:

```batchfile
C:\Users\%USERNAME%\AppData\Local\Programs\Quarto\bin\tools
```

### Quarto

Quarto installed via `choco install quarto`:

```batchfile
C:\ProgramData\chocolatey\lib\quarto\tools\bin
```

Quarto installed via Quarto standalone installer:

```batchfile
C:\Users\%USERNAME%\AppData\Local\Programs\Quarto\bin
```

Quarto distributed with RStudio Desktop (installer):

```batchfile
C:\Program Files\RStudio\resources\app\bin\quarto\bin
```

Quarto distributed with RStudio Desktop (zip):

```batchfile
C:\Users\%USERNAME%\RStudio-`r sprintf("%s-%s", rstudio_version_major, rstudio_version_minor)`\resources\app\bin\quarto\bin
```

### Git

For interacting with Git repositories.

Git for Windows installed via `choco install git` or standalone installer:

```batchfile
C:\Program Files\Git\cmd
```

## Configure and verify

1. Locate the paths on your system.
- Open File Explorer and navigate to the directories listed above.
- Verify that the paths exist and contain the expected executables.
1. Add relevant paths to your system's `PATH` environment variable
and verify the setup.
- For a step-by-step guide with screenshots, see
[how to set the `PATH` environment variable in Windows](path.md).

Now you should be able to use R and its associated tools from the CLI
without specifying full paths.