On 01/03/2011 09:06 PM, Hadley Wickham wrote: >> Correct. I'm doing this because of non-exported functions in other packages, >> so I need ::: > > But you really really shouldn't be doing that. Is there a reason that > the package authors won't export the functions? > >> I'd still appreciate any insight about whether importFrom in NAMESPACE >> defers package loading so that if the package is not actually used (and is >> not installed) there will be no problem.
I think that with importFrom(packagename, functioname), the package will fail to INSTALL with message "object 'functioname' is not exported by namespace:packagename'". If the function is exported from packagname, then R CMD check will complain that 'Namespace dependency not required: packagename', which is to say that Imports: packagename is needed in the DESCRIPTION file. Packages that are listed in the Imports field of DESCRIPTION must be available at install time, so this implies that the user has packagename installed. I think this is trying to corral you to good programming practice: use Imports: packagename in the DESCRIPTION, use importsFrom(packagename, functioname) in the NAMESPACE, and only use functions that are exported from packagename. Martin > > Imported packages need to be installed - but it's the import vs. > suggests vs. depends statement in DESCRIPTION that controls this > behaviour, not the namespace. > > Hadley > > -- Computational Biology Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: M1-B861 Telephone: 206 667-2793 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.