[Rd] How to understand packages, namespaces, environments

From: Alexander Stoddard <astoddar_at_mail.med.upenn.edu>
Date: Fri 06 May 2005 - 16:45:03 GMT

I would be very glad of pointers to information on how the concepts of packages, namespaces and environments are interrelated in R.

I am trying to get a handle on this both so I can delve further into understanding other people's code and so I can organize my own in a more coherent manner.

 From my reading about environments it seems they function as what I would intuitively call namespaces. However, the documentation for the 'library' function implies that "namespace" has a specific meaning in R that I have so far failed to grasp. What is that meaning (or where should I look to read up on it) ?

I can think of the following more specific questions. Perhaps they may most usefully serve to reveal my misconceptions, so corrections would be very helpful.

Does saying the following load package 'foo' into its own environment ?
> library(foo)

Do environments have names?

Of what does the list returned by search() actually consist? Is it a list of environments, a list that may include environments, or something else?

What is actually designated by a character vector of form "package:foo"?

In what ways can I use the character vector "package:foo" when interacting with R?

Many thanks,
Alex Stoddard

P.S. It took me a long time of flailing about to discover the 'search' function. Perhaps it could be included in the "See Also" section of the help for 'ls'.

R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat May 07 02:57:51 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:05 GMT