knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

Sys.setenv(RSTUDIO_CONSOLE_WIDTH = 50)

CRAN_Status_Badge Coverage status Covrpage Summary

whereamir if(knitr::opts_knit$get('rmarkdown.pandoc.to')=='gfm-ascii_identifiers') '<img src="https://github.com/yonicd/whereami/raw/media/hex/whereami_small.png" align="right" />'

The goal of whereami is to reliably find where command is run from.

Installation

remotes::install_github("yonicd/whereami")

Example

library(whereami)
library(ggplot2)

General

whereami()

Plots

ggplot(iris) + 
  aes(x=Sepal.Length,y=Sepal.Width) + 
  geom_point() + 
  labs(caption = sprintf('sourced from: %s',whereami()))

Shiny

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().

In this case the traceback functionality of whereami() to return the line where the function was sourced is not enabled.



yonicd/whereami documentation built on Jan. 9, 2023, 9:59 a.m.