home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Educational / R-0.49-MI / R-0.49-M / help / base / library < prev    next >
Encoding:
Text File  |  1997-04-23  |  3.9 KB  |  101 lines

  1.     
  2.     _L_o_a_d _A_p_p_l_i_c_a_t_i_o_n _L_i_b_r_a_r_i_e_s
  3.     
  4.          library(name)
  5.          library.dynam("name.so")
  6.          require(name, quietly=FALSE)
  7.          provide(name)
  8.     
  9.     _A_r_g_u_m_e_n_t_s:
  10.     
  11.              name: The name of a library.  With no argument
  12.                    library will print out a list of available
  13.                    libraries.
  14.     
  15.          quietly : With quietly=TRUE a warning will not be
  16.                    printed if the library cannot be found.
  17.     
  18.     _D_e_s_c_r_i_p_t_i_o_n:
  19.     
  20.          library and require both load a library.  require is
  21.          designed for use inside other functions; it returns
  22.          FALSE and optionally gives a warning, rather than giv-
  23.          ing an error, if the library does not exist.  Both
  24.          functions check and update the list of currently loaded
  25.          libraries stored in .Libraries and do not reload code
  26.          that is already loaded, require also checks the list
  27.          .Provided. provide allows code to register services
  28.          that it provides. The argument is stored in the list
  29.          .Provided.  provide returns FALSE if the name was
  30.          already present in
  31.     
  32.          The main use for provide is when multiple libraries
  33.          share code.  This is most likely when the code imple-
  34.          ments features present in S(-PLUS) but not in R. For
  35.          example, the spline functions ns, bs and so on are not
  36.          included in the R distribution.  A library that con-
  37.          tains these functions can use provide(splines) to
  38.          register this fact. Another library that needs the
  39.          functions can execute require(splines) rather than
  40.          library(splines) to load the spline library only if
  41.          their functionality is not already available.
  42.     
  43.          library() with no argument gives a list of available
  44.          libraries; provide() with no argument returns
  45.          list(.Provided, .Libraries).
  46.     
  47.          library.dynam() loads the specified object file from
  48.          RHOME/lib if it has not been loaded already. It is
  49.          designed to be used inside a library rather than at the
  50.          command line.
  51.     
  52.          help(library(name)) prints a list of functions in
  53.          library "name".
  54.     
  55.          Libraries provide a mechanism for loading optional code
  56.          and its documentation as needed. Libraries are compiled
  57.          and installed from subdirectories of RHOME/src/library;
  58.          eda and mva are provided as examples.
  59.     
  60.          A library consists of a subdirectory containing a TITLe
  61.          and INDEX file, and subdirectories funs, man, src and
  62.          src-c.  The TiTLE file contains a line giving the name
  63.          of the library and a brief description. INDEX contains
  64.          a line for each sufficiently interesting function in
  65.          the library, giving its name and a description (func-
  66.          tions such as print methods not usually called expli-
  67.          citly might not be included).
  68.     
  69.          The funs subdirectory contains R code files with names
  70.          beginning with lowercase letters. One of these files
  71.          should use library.dynam() to load any necessary com-
  72.          piled code.
  73.     
  74.          Source and a Makefile for the compiled code is in src,
  75.          and a pure C version of the source should be in src-c.
  76.          In the common case when all the source is in C it may
  77.          be convenient to make one of these directories a sym-
  78.          bolic link to the other. The Makefile will be passed
  79.          various machine-dependent compile and link flags, exam-
  80.          ples of which can be seen in the eda library.
  81.     
  82.          The man subdirectory should contain R help files for
  83.          the functions in the library.
  84.     
  85.          To install a library run make libs in RHOME/src/library
  86.          and then run etc/lib-installhelp in RHOME. This will
  87.          reinstall all the libraries.
  88.     
  89.     _V_a_l_u_e:
  90.     
  91.          library returns the list of loaded libraries; require
  92.          returns a boolean value indicating whether the required
  93.          library is available.
  94.     
  95.     _E_x_a_m_p_l_e_s:
  96.     
  97.          library(eda)
  98.          require(eda)
  99.          require(nonexistent)
  100.     
  101.