Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yonicd/whereami
Reliably return location where command is called from in R.
https://github.com/yonicd/whereami
Last synced: 27 days ago
JSON representation
Reliably return location where command is called from in R.
- Host: GitHub
- URL: https://github.com/yonicd/whereami
- Owner: yonicd
- License: other
- Created: 2019-02-23T14:33:57.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-22T20:37:57.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T21:28:53.141Z (2 months ago)
- Language: HTML
- Homepage: https://yonicd.github.io/whereami/index.html
- Size: 14.8 MB
- Stars: 41
- Watchers: 6
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - yonicd/whereami - Reliably return location where command is called from in R. (HTML)
README
---
output: github_document
---```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)Sys.setenv(RSTUDIO_CONSOLE_WIDTH = 50)
```[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/whereami)](https://cran.r-project.org/package=whereami)
[![](https://cranlogs.r-pkg.org/badges/whereami)](https://cran.r-project.org/package=whereami)
[![Coverage status](https://codecov.io/gh/yonicd/whereami/branch/master/graph/badge.svg)](https://codecov.io/github/yonicd/whereami?branch=master)
[![Covrpage Summary](https://img.shields.io/badge/covrpage-Last_Build_2022_12_21-red.svg)](http://tinyurl.com/y5c5voy3)# whereami`r if(knitr::opts_knit$get('rmarkdown.pandoc.to')=='gfm-ascii_identifiers') ''`
The goal of whereami is to reliably find where command is run from.
## Installation
``` r
remotes::install_github("yonicd/whereami")
```## Example
```{r}
library(whereami)
library(ggplot2)
```### General
```{r basic,R.options=list(width = 50)}
whereami()
```### Plots
```{r plot}
ggplot(iris) +
aes(x=Sepal.Length,y=Sepal.Width) +
geom_point() +
labs(caption = sprintf('sourced from: %s',whereami()))```
### Shiny
![](https://github.com/yonicd/whereami/blob/media/whereami_shiny.gif?raw=true)
## Non RStudio session
If you are running a non RStudio script ie from terminal R/Rscript then the package falls back to `thisfile()`, which has been migrated from [rprojroot::thisfile()](https://rprojroot.r-lib.org/reference/thisfile.html).
In this case the traceback functionality of `whereami()` to return the line where the function was sourced is not enabled.