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

importas

R build status Codecov test coverage Netlify Status

Get objects from packages via aliases of packages and the $ operator. The %as% infix operator works in the way similar to Python's Import spam as ham

Installation

remotes::install_github("atusy/importas")

Example

library(importas)

# Define an alias of a package, 
# and access the object from the package via the alias
graphics %as% gr
gr$plot

# A more R-like syntax is
gr <- package(graphics)

# Define aliases at once
importas(ut = utils, st = stats)
ut$str
st$median


atusy/pkgas documentation built on Sept. 22, 2020, 10:52 p.m.