Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. R
  3. import

import

NOASSERTIONRv1.3.2

An R package providing a selective import mechanism for functions from packages and modules, avoiding namespace pollution.

Visit WebsiteGitHubGitHub
231 stars15 forks0 contributors

What is import?

import is an R package that provides a selective import mechanism for functions from external packages and custom R module scripts. It solves the problem of namespace pollution and masking conflicts that occur when loading entire packages with `library()`, allowing developers to import only the specific functions they need.

Target Audience

R developers and data scientists who work with multiple packages and want to avoid namespace conflicts, improve code clarity, and adopt modular programming practices in their scripts and projects.

Value Proposition

Developers choose import over base R's `library()` because it offers precise control over function imports, prevents naming conflicts, supports custom modules, and integrates seamlessly into existing workflows without requiring major changes to code structure.

Overview

An Import Mechanism For R

Use Cases

Best For

  • Avoiding namespace conflicts when using functions with common names from different packages
  • Importing only specific functions from large packages to reduce memory footprint
  • Creating modular R scripts that reuse functions from custom .R files
  • Improving code readability by making function origins explicit
  • Managing dependencies in R packages without exposing internal imports
  • Renaming imported functions to fit project naming conventions

Not Ideal For

  • Projects that prioritize minimal external dependencies and can rely solely on base R's new include.only/exclude features in library()
  • Scripts requiring frequent programmatic or dynamic imports where .character_only parameter adds unnecessary boilerplate
  • Teams already standardized on the conflicted package for a different, error-driven approach to namespace conflicts
  • Environments where simplicity and immediate readability are paramount, and the extra syntax of import::from() outweighs benefits

Pros & Cons

Pros

Selective Namespace Control

Allows importing only specific functions from packages, preventing masking conflicts and reducing memory overhead, as demonstrated by importing just impute() and nomiss() from Hmisc instead of all 400+ functions.

Custom Module Support

Enables importing functions from external R script files (modules), facilitating code modularity and reuse, shown with examples like sequence_module.R for mathematical functions.

Flexible Function Renaming

Easy aliasing of functions to avoid naming clashes, such as renaming dplyr's filter to keep_when, improving code clarity without altering logic.

Advanced Import Parameters

Offers fine-grained control with .all, .except, .into, and .character_only for complex scenarios, like grouping imports into custom search path entities or handling variable names.

Cons

Redundancy with Base R

Base R's library() now includes include.only and exclude arguments for selective imports, making import less essential for basic use cases, as noted in the 'See also' section.

Cumbersome Dynamic Imports

Requires .character_only=TRUE for importing from variable names (e.g., module_name), adding an extra step and complexity compared to symbolic evaluation, which can be error-prone.

Potential Breaking Changes

Default behavior has shifted, such as the .library parameter changing from using only the first library path to all paths in version 1.3.0, which could disrupt existing workflows without clear migration paths.

Frequently Asked Questions

Quick Stats

Stars231
Forks15
Contributors0
Open Issues5
Last commit9 months ago
CreatedSince 2015

Tags

#r-package#r-programming#code-modularity#dependency-management#r#namespace-management#package-development#cran

Built With

R
R

Links & Resources

Website

Included in

R6.4k
Auto-fetched 18 hours ago

Related Projects

devtools <img class="emoji" alt="heart" src="https://cdn.jsdelivr.net/gh/qinwf/awesome-R@3c66da6e291bcc0520b1649125b0bed750896a9a/heart.png" height="20" align="absmiddle" width="20">devtools <img class="emoji" alt="heart" src="https://cdn.jsdelivr.net/gh/qinwf/awesome-R@3c66da6e291bcc0520b1649125b0bed750896a9a/heart.png" height="20" align="absmiddle" width="20">

Tools to make an R developer's life easier

Stars2,514
Forks762
Last commit2 months ago
lintrlintr

Static Code Analysis for R

Stars1,288
Forks200
Last commit1 day ago
renv <img class="emoji" alt="heart" src="https://cdn.jsdelivr.net/gh/qinwf/awesome-R@3c66da6e291bcc0520b1649125b0bed750896a9a/heart.png" height="20" align="absmiddle" width="20">renv <img class="emoji" alt="heart" src="https://cdn.jsdelivr.net/gh/qinwf/awesome-R@3c66da6e291bcc0520b1649125b0bed750896a9a/heart.png" height="20" align="absmiddle" width="20">

renv: Project environments for R.

Stars1,161
Forks170
Last commit1 day ago
box <img class="emoji" alt="heart" src="https://cdn.jsdelivr.net/gh/qinwf/awesome-R@3c66da6e291bcc0520b1649125b0bed750896a9a/heart.png" height="20" align="absmiddle" width="20">box <img class="emoji" alt="heart" src="https://cdn.jsdelivr.net/gh/qinwf/awesome-R@3c66da6e291bcc0520b1649125b0bed750896a9a/heart.png" height="20" align="absmiddle" width="20">

Write reusable, composable and modular R code

Stars970
Forks49
Last commit1 month ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub