3

The section on NAMESPACE files from the Writing R extensions manual says:

Using importFrom selectively rather than import is good practice.

Why is this true? Is this just to protect yourself from masking and naming conflicts when importing multiple packages, or is there a performance difference?

Jeroen Ooms
  • 31,998
  • 35
  • 134
  • 207
  • [Maybe useful](http://stackoverflow.com/questions/7283134/what-is-the-benefit-of-import-in-a-namespace-in-r), if not a duplicate. – Martin Morgan May 23 '13 at 01:06
  • 2
    I had to write a package for a class, so I know firsthand that selectively using `importFrom` rather than `import` prevents you from inadvertently grabbing things that you didn't want to and leading to conflicts. I recall introducing a bug because a function I named was the same as a function that I `import`ed. I can't imagine that there is notable performance difference. – daikonradish May 23 '13 at 05:42

0 Answers0