Detection and Localization of Executable Files

A set of functions to locate some programs available on the user machine. It can locate 'Node.js', 'npm', 'LibreOffice', 'Microsoft Word', 'Microsoft PowerPoint', 'Microsoft Excel', 'Python', 'pip', 'Mozilla Firefox', 'Google Chrome', 'Air' and 'Pandoc'. The user can test the availability of a program, optionally with a required version, and call it with the functions system2() or system(). This allows the use of a single function to retrieve the path to a program regardless of the operating system and its configuration.


locatexec

R buildstatus version codecov testcoverage

The package helps locate external programs such as “python”, “Google Chrome”, “node.js” and “LibreOffice” so that they can be called easily from R.

This makes it easier to call these programs from R across various operating systems.

library(locatexec)

if(exec_available("node")){
  message(exec_version("node"))
  message(node_exec())
}
#> 26.0.0
#> /opt/homebrew/bin/node
exec exec_fun available version path
node node_exec() TRUE 26.0.0 /opt/homebrew/bin/node
chrome chrome_exec() TRUE 148.0.7778.179 /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
python python_exec() TRUE 3.9.6 /usr/bin/python3
libreoffice libreoffice_exec() TRUE 26.2.3.2 /opt/homebrew/bin/soffice
excel excel_exec() TRUE 16.109.1 /Applications/Microsoft Excel.app/Contents/MacOS/Microsoft Excel
powerpoint powerpoint_exec() TRUE 16.109.1 /Applications/Microsoft PowerPoint.app/Contents/MacOS/Microsoft PowerPoint
pip pip_exec() TRUE 21.2.4 /usr/bin/pip3
firefox firefox_exec() TRUE 151.0.1 /Applications/Firefox.app/Contents/MacOS/firefox
npm npm_exec() TRUE 11.12.1 /opt/homebrew/bin/npm
word word_exec() TRUE 16.109.1 /Applications/Microsoft Word.app/Contents/MacOS/Microsoft Word
air air_exec() TRUE 0.8.0 /Users/username/.local/bin/air
pandoc pandoc_exec() TRUE 3.9.0.2 /opt/homebrew/bin/pandoc

Motivations

This was motivated by the need for tools similar to rmarkdown::pandoc_available() and rmarkdown::pandoc_exec() but allowing to locate external programs other than pandoc.

I needed to call these programs from R without pulling in heavy dependencies.

Installation

You can install the CRAN version with:

install.packages("locatexec")

Related work

  • Package pagedown provides find_chrome() for finding “Google Chrome”.

  • Package findpython provides find_python_cmd() for finding “python”.

  • If you want to go deeper with ‘R’ and ‘node.js’, I recommend package packer.

  • If you want to go deeper with ‘R’ and ‘Python’, I recommend package reticulate.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("locatexec")

0.2.0 by David Gohel, 5 months ago


https://ardata-fr.github.io/locatexec/


Report a bug at https://github.com/ardata-fr/locatexec/issues


Browse source code at https://github.com/cran/locatexec


Authors: David Gohel [aut, cre] , ArData [cph]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports utils

Suggests testthat


Imported by doconv.


See at CRAN