Title: | Simple Utility Providing Terminal Access to all R Functions |
---|---|
Description: | A small utility which wraps Rscript and provides access to all R functions from the shell. |
Authors: | Sahil Seth [aut, cre] |
Maintainer: | Sahil Seth <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.3.4 |
Built: | 2025-02-17 04:45:04 UTC |
Source: | https://github.com/sahilseth/funr |
Wraps Rscript in a easy to use manner, exposing all R functions from the terminal. The github page provides more details with examples, highlights and caveats.
funr(args, help_text, script_name = "funr")
funr(args, help_text, script_name = "funr")
args |
Should always be: |
help_text |
A simple text to be displayed describing options and usage of this interface. Supplying this, replaces the default text. |
script_name |
Name of the script. This is used in the the help text. [funr] |
https://github.com/sahilseth/funr
## show funr help ## terminal version: funr -h funr() ## show rnorm help ## terminal version: funr -h rnorm render_funr(funr(args=c("-h", "rnorm"))) ## Generate a few random numbers ## terminal version: funr rnorm n=10 render_funr(funr(args=c("rnorm", "n=10")))
## show funr help ## terminal version: funr -h funr() ## show rnorm help ## terminal version: funr -h rnorm render_funr(funr(args=c("-h", "rnorm"))) ## Generate a few random numbers ## terminal version: funr rnorm n=10 render_funr(funr(args=c("rnorm", "n=10")))
R does not have a default way to return and use, the location of a specific script.
get_script_path() detect_home()
get_script_path() detect_home()
https://github.com/molgenis/molgenis-pipelines/wiki/How-to-source-another_file.R-from-within-your-R-script
If the function returns with invisible, output is suppressed
render_funr(x, max_rows = 100)
render_funr(x, max_rows = 100)
x |
a output from |
max_rows |
In case output of a function is a data.frame, the number of rows to display. |
Setup and initialize some scripts.
setup(bin = "~/bin")
setup(bin = "~/bin")
bin |
path to bin folder |
Will add more to this to identify cluster and aid in other things
Get path of current script
sys.script()
sys.script()
http://stackoverflow.com/questions/1815606/rscript-determine-path-of-the-executing-script
## Not run: ## cat foo.R ## library(funr);sys.script() ## source("foo.R") ## Rscript foo.R ## End(Not run)
## Not run: ## cat foo.R ## library(funr);sys.script() ## source("foo.R") ## Rscript foo.R ## End(Not run)