Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making R-Package: NAMESPACE

Tags:

package

r

I am creating a R-package and I am at the step where I BUILD the package.

I have read the Writing R Extensions documentation about NAMESPACE (more specifically the sections 1.5.1 and 1.5.2 on import, export and on registering S3method).

I am worrying about this step because when I CHECKmy package I got this warning:

Found the following apparent S3 methods exported but not registered: print.myClass print.myOtherClass summary.myClass summary.myOtherClass See section 'Registering S3 methods' in the 'Writing R Extensions' manual.

Any help in deciphering what are the consequences of not registering a S3method and about the NAMESPACE file in general would make my day.

Thanks for your help.

like image 615
Alex Fortin Avatar asked May 25 '15 20:05

Alex Fortin


People also ask

What is NAMESPACE in R package?

When there are, two functions of some name available in two different libraries, identifying which function to use is difficult. Namespace functions are used for overcoming this problem where it provides additional information to differentiate between the same function names present in different libraries in R.

What is a NAMESPACE File in R?

The NAMESPACE file specifies the functions in the package that are exported to the user, and functions or packages that are imported by the package. Exported functions are functions from our package that are accessible by the user, and imported functions are functions from other packages used by our package.


1 Answers

I would bet 10:1 that you wrote something like

export(print.myClass)

in the namespace. Instead, you need to write

S3method(print, myClass)
like image 94
Cliff AB Avatar answered Oct 03 '22 10:10

Cliff AB