Learn R Programming

locatexec

The package aims to allow the localization of external programs such as “python”, “Google Chrome”, “node.js” and “LibreOffice” in order to be able to easily call them from R.

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

library(locatexec)

if(exec_available("node")){
  message(exec_version("node"))
  message(node_exec())
}
#> 12.16.0
#> C:/Program Files/nodejs/node.exe
execexec_funavailableversionpath
nodenode_exec()TRUE12.16.0C:/Program Files/nodejs/node.exe
chromechrome_exec()TRUE89.0.4389.82C:/Program Files (x86)/Google/Chrome/Application/chrome.exe
pythonpython_exec()TRUE3.9.1C:/Users/dgohe/AppData/Local/Programs/Python/Python39/python.exe
libreofficelibreoffice_exec()TRUE7.1.0.3C:/Program Files/LibreOffice/program/soffice.com
excelexcel_exec()TRUE16C:/Program Files/Microsoft Office/root/Office16/EXCEL.exe
powerpointpowerpoint_exec()TRUE16C:/Program Files/Microsoft Office/root/Office16/POWERPNT.exe
pippip_exec()TRUE20.2.3C:/Users/dgohe/AppData/Local/Programs/Python/Python39/Scripts/pip.exe
firefoxfirefox_exec()TRUE86.0.1C:/Program Files/Mozilla Firefox/firefox.exe
npmnpm_exec()TRUE6.13.4C:/Program Files/nodejs/npm.cmd
wordword_exec()TRUE16C:/Program Files/Microsoft Office/root/Office16/WINWORD.exe

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 need to use these programs from R without having heavy dependencies. These functions will mainly be used to automate some visual tests or to improve the documentation of other packages.

Installation

You can install the CRAN version with:

install.packages("locatexec")

Related work

  • Packages pagedown is providing find_chrome() for finding “Google Chrome”.

  • Packages findpython is providing 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.

Copy Link

Version

Install

install.packages('locatexec')

Monthly Downloads

6,680

Version

0.1.1

License

MIT + file LICENSE

Maintainer

David Gohel

Last Published

May 19th, 2021

Functions in locatexec (0.1.1)

exec_locate

Find an executable
excel_exec

Path to 'Microsoft Execl' executable
is_unix

Test if the system is "unix"
exec_version

Get executable version
chrome_exec

Path to 'Google Chrome' executable
libreoffice_exec

Path to 'LibreOffice' executable
is_osx

Test if the system is "macOS"
exec_available

Check executable availability and version
is_windows

Test if the system is "Windows"
python_exec

Path to 'python' executable
firefox_exec

Path to 'Mozilla Firefox' executable
powerpoint_exec

Path to 'Microsoft PowerPoint' executable
pip_exec

Path to 'pip' executable
word_exec

Path to 'Microsoft Word' executable
npm_exec

Path to 'npm' executable
node_exec

Path to 'node.js' executable