home *** CD-ROM | disk | FTP | other *** search
-
- _L_o_a_d _A_p_p_l_i_c_a_t_i_o_n _L_i_b_r_a_r_i_e_s
-
- library(name)
- library.dynam("name.so")
- require(name, quietly=FALSE)
- provide(name)
-
- _A_r_g_u_m_e_n_t_s:
-
- name: The name of a library. With no argument
- library will print out a list of available
- libraries.
-
- quietly : With quietly=TRUE a warning will not be
- printed if the library cannot be found.
-
- _D_e_s_c_r_i_p_t_i_o_n:
-
- library and require both load a library. require is
- designed for use inside other functions; it returns
- FALSE and optionally gives a warning, rather than giv-
- ing an error, if the library does not exist. Both
- functions check and update the list of currently loaded
- libraries stored in .Libraries and do not reload code
- that is already loaded, require also checks the list
- .Provided. provide allows code to register services
- that it provides. The argument is stored in the list
- .Provided. provide returns FALSE if the name was
- already present in
-
- The main use for provide is when multiple libraries
- share code. This is most likely when the code imple-
- ments features present in S(-PLUS) but not in R. For
- example, the spline functions ns, bs and so on are not
- included in the R distribution. A library that con-
- tains these functions can use provide(splines) to
- register this fact. Another library that needs the
- functions can execute require(splines) rather than
- library(splines) to load the spline library only if
- their functionality is not already available.
-
- library() with no argument gives a list of available
- libraries; provide() with no argument returns
- list(.Provided, .Libraries).
-
- library.dynam() loads the specified object file from
- RHOME/lib if it has not been loaded already. It is
- designed to be used inside a library rather than at the
- command line.
-
- help(library(name)) prints a list of functions in
- library "name".
-
- Libraries provide a mechanism for loading optional code
- and its documentation as needed. Libraries are compiled
- and installed from subdirectories of RHOME/src/library;
- eda and mva are provided as examples.
-
- A library consists of a subdirectory containing a TITLe
- and INDEX file, and subdirectories funs, man, src and
- src-c. The TiTLE file contains a line giving the name
- of the library and a brief description. INDEX contains
- a line for each sufficiently interesting function in
- the library, giving its name and a description (func-
- tions such as print methods not usually called expli-
- citly might not be included).
-
- The funs subdirectory contains R code files with names
- beginning with lowercase letters. One of these files
- should use library.dynam() to load any necessary com-
- piled code.
-
- Source and a Makefile for the compiled code is in src,
- and a pure C version of the source should be in src-c.
- In the common case when all the source is in C it may
- be convenient to make one of these directories a sym-
- bolic link to the other. The Makefile will be passed
- various machine-dependent compile and link flags, exam-
- ples of which can be seen in the eda library.
-
- The man subdirectory should contain R help files for
- the functions in the library.
-
- To install a library run make libs in RHOME/src/library
- and then run etc/lib-installhelp in RHOME. This will
- reinstall all the libraries.
-
- _V_a_l_u_e:
-
- library returns the list of loaded libraries; require
- returns a boolean value indicating whether the required
- library is available.
-
- _E_x_a_m_p_l_e_s:
-
- library(eda)
- require(eda)
- require(nonexistent)
-
-