Skip to content
/ importas Public

Define Aliases of Packages Like Python's Import As

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

atusy/importas

Repository files navigation

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
#> function (x, y, ...) 
#> UseMethod("plot")
#> <bytecode: 0x55ab7a951bc8>
#> <environment: namespace:base>

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

# Define aliases at once
importas(ut = utils, st = stats)
ut$str
#> function (object, ...) 
#> UseMethod("str")
#> <bytecode: 0x55ab7b075ae0>
#> <environment: namespace:utils>
st$median
#> function (x, na.rm = FALSE, ...) 
#> UseMethod("median")
#> <bytecode: 0x55ab7bb5b920>
#> <environment: namespace:stats>

About

Define Aliases of Packages Like Python's Import As

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages