gh | R Documentation |
The function gh
carries out the following operation on a file named x
.
It searches for a match for x
within the active repository, utilizing fuzzy string
matching. If no unique match is identified, an error is thrown along with suggestions for
potential "best" matches.
Otherwise, the following operation are performed:
gh(x, 'open')
or ghopen(x)
: Opens a file in the local browser if the file extension is html
or pdf
, otherwise in the RStudio editor.
gh(x, 'load')
or ghload(x)
: Loads the contents of a file with import
.
gh(x, 'source')
or ghsource(x)
: Executes the contents of a file with source
.
gh(x, 'app')
or ghapp(x)
: Tries to open the file with the default application of the OS, see defaultApp()
.
ghdata(x, pkg)
: Helper function to load data sets from R packages into Python, simulates pkg::x
.
gh(x, what = c("open", "load", "source", "app"), ..., .call = NULL)
ghopen(x, ...)
ghload(x, ...)
ghsource(x, ...)
ghapp(x, ...)
x |
character(1): name of the file, app or data set |
what |
character or function: a name of a predefined function or another function. The function must have a formal parameter |
... |
further parameters used in |
.call |
the original function call (default: |
invisibly the result of utils::browseURL, openFile()
, rio::import()
, or base::source()
.
if (interactive()) {
x <- ghopen("bank2.SAV")
x <- ghload("bank2.SAV")
str(x)
x <- ghsource("univariate/example_ecdf.R")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.