https://github.com/ardata-fr/locatexec
https://github.com/ardata-fr/locatexec
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ardata-fr/locatexec
- Owner: ardata-fr
- License: other
- Created: 2021-03-01T09:29:14.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-09T08:59:54.000Z (over 1 year ago)
- Last Synced: 2024-11-24T12:46:15.555Z (5 months ago)
- Language: R
- Size: 47.9 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - ardata-fr/locatexec - (R)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(locatexec)
```# locatexec
[](https://github.com/ardata-fr/locatexec/actions)
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.```{r}
library(locatexec)if(exec_available("node")){
message(exec_version("node"))
message(node_exec())
}
``````{r echo=FALSE}
execs <- c("node", "chrome", "python", "libreoffice", "excel", "powerpoint",
"pip", "firefox", "npm", "word")
exec_cmd <- paste0(execs, "_exec")dat <- data.frame(
exec = execs,
exec_fun = paste0("`", exec_cmd, "()`"),
available = vapply(execs, exec_available, FUN.VALUE = FALSE),
version = vapply(execs, function(exec) format(exec_version(exec)), FUN.VALUE = NA_character_),
stringsAsFactors = FALSE, row.names = NULL)path <- character(nrow(dat))
path[dat$available] <- sapply(
exec_cmd[dat$available],
function(cmd){
do.call(cmd, list())
})
path[!dat$available] <- NA_character_
dat$path <- path
knitr::kable(dat)
```## 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:
``` r
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](https://packer.john-coene.com/).* If you want to go deeper with 'R' and 'Python', I recommend
package [reticulate](https://rstudio.github.io/reticulate/).