1

My the R package depends upon other package (for example "fields")

What is best practice to ensure that the package is loaded, when my package is loaded.

Should I write cover r program to do this ? Can or should such dependencies distributed with my distribution ?

I will appreciate a detail answer with scrips

Edit: As per following suggestion I added the following in Discription file.

Depends: R (>= 1.8.0), fields

Still the fields package is not loaded automatically when I load my package.

jon
  • 11,186
  • 19
  • 80
  • 132

1 Answers1

5

This is something you specify in your DESCRIPTION file that you ship with your package. You can use either the 'Depends' field, or better is to use 'Imports' field in combination with a NAMESPACE file. Have a look at the DESCRIPTION and NAMESPACE files from some other packages, or read over the Writing R Extensions manual.

Jeroen Ooms
  • 31,998
  • 35
  • 134
  • 207
  • See my edits, I do not know what else I need to with NAMESPACE. My namespace has just exportPattern("^[[:alpha:]]+") – jon Apr 21 '12 at 21:22
  • 1
    Did you reinstall your package after updating the DESCRIPTION? This should work. Also make sure that you don't have multiple copies of the package installed in multiple libraries (hence you might be loading an 'old' version of your package'. – Jeroen Ooms Apr 21 '12 at 21:28