MyNixOS website logo
Description

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
execexec_funavailableversionpath
nodenode_exec()TRUE26.0.0/opt/homebrew/bin/node
chromechrome_exec()TRUE148.0.7778.179/Applications/Google Chrome.app/Contents/MacOS/Google Chrome
pythonpython_exec()TRUE3.9.6/usr/bin/python3
libreofficelibreoffice_exec()TRUE26.2.3.2/opt/homebrew/bin/soffice
excelexcel_exec()TRUE16.109.1/Applications/Microsoft Excel.app/Contents/MacOS/Microsoft Excel
powerpointpowerpoint_exec()TRUE16.109.1/Applications/Microsoft PowerPoint.app/Contents/MacOS/Microsoft PowerPoint
pippip_exec()TRUE21.2.4/usr/bin/pip3
firefoxfirefox_exec()TRUE151.0.1/Applications/Firefox.app/Contents/MacOS/firefox
npmnpm_exec()TRUE11.12.1/opt/homebrew/bin/npm
wordword_exec()TRUE16.109.1/Applications/Microsoft Word.app/Contents/MacOS/Microsoft Word
airair_exec()TRUE0.8.0/Users/username/.local/bin/air
pandocpandoc_exec()TRUE3.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.

Metadata

Version

0.2.0

License

Unknown

Platforms (79)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    wasip1
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasip1
  • wasm64-wasip1
  • x86_64-cygwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows