[R] R package & namespace questions

Duncan Murdoch dmurdoch at pair.com
Tue Sep 18 02:47:38 CEST 2001

On Mon, 17 Sep 2001 18:47:36 -0400, you wrote:

>i'm unclear on ".Internal" functions in R.
>Do ".Internal" functions mean:
>1) functions (to be) used only inside a package (like private methods)
>2) do they mean functions that call upon the R - C interface?

They're functions that are written in C as part of the R source code.

>Related to this, how are namespaces handled in R?

They aren't, but I believe I heard they are being planned.  No idea
when they'll arrive.
>It seems that i could write a function read.table(), place it in my own file, source the file and there would be *no warning* that it interferes with the base package's read.table() function?  This seems quite unsafe to me coming from a Java background where namespaces are very controlled.

Yes, it is dangerous.  Note though that if you did the same thing in a
package, you would get a warning about it.  Packages are a good idea.

>Finally, a function i wrote, placed in a file.R and sourc'ed:
>misc.expand_table <- function(vec, n)
># something
>seems to redefine the base function "table".

That's because the underscore is a synonym for the assignment operator
<-.  Your first line is equivalent to 

 misc.expand <- table <- function(vec,n)

Duncan Murdoch
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list