packageDescription           package:utils           R Documentation

_P_a_c_k_a_g_e _D_e_s_c_r_i_p_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Parses and returns the 'DESCRIPTION' file of a package.

_U_s_a_g_e:

     packageDescription(pkg, lib.loc = NULL, fields = NULL, drop = TRUE,
                        encoding = "")

_A_r_g_u_m_e_n_t_s:

     pkg: a character string with the package name.

 lib.loc: a character vector of directory names of R libraries, or
          'NULL'.  The default value of 'NULL' corresponds to all
          libraries currently known.  If the default is used, the
          loaded packages are searched before the libraries.

  fields: a character vector giving the tags of fields to return (if
          other fields occur in the file they are ignored).

    drop: If 'TRUE' and the length of 'fields' is 1, then a single
          character string with the value of the respective field is
          returned instead of an object of class
          '"packageDescription"'.

encoding: If there is an 'Encoding' field, to what encoding should
          re-encodong be attempted?  If 'NA', no re-encoding.  The
          other values are as used by 'iconv', so the default '""'
          indicates the encoding of the current locale.

_D_e_t_a_i_l_s:

     A package will not be 'found' unless it has a 'DESCRIPTION' file
     which contains a valid 'Version' field.  Different warnings are
     given when no package directory is found and when there is a
     suitable directory but no valid 'DESCRIPTION' file.

_V_a_l_u_e:

     If a 'DESCRIPTION' file for the given package is found and can
     successfully be read, 'packageDescription' returns an object of
     class '"packageDescription"', which is a named list with the
     values of the (given) fields as elements and the tags as names,
     unless 'drop = TRUE'.

     If parsing the 'DESCRIPTION' file was not successful, it returns a
     named list of 'NA's with the field tags as names if 'fields' is
     not null, and 'NA' otherwise.

_S_e_e _A_l_s_o:

     'read.dcf'

_E_x_a_m_p_l_e_s:

     packageDescription("stats")
     packageDescription("stats", fields = c("Package", "Version"))

     packageDescription("stats", fields = "Version")
     packageDescription("stats", fields = "Version", drop = FALSE)

