readNEWS                package:tools                R Documentation

_R_e_a_d _R'_s _N_E_W_S _f_i_l_e _o_r _a _s_i_m_i_l_a_r _o_n_e

_D_e_s_c_r_i_p_t_i_o_n:

     Read R's NEWS file or a similarly formatted one. This is an
     experimental feature, new in R 2.4.0 and may change in several
     ways.

_U_s_a_g_e:

     readNEWS(file = file.path(R.home(), "NEWS"), trace = FALSE,
              chop = c("first", "1", "par1", "keepAll"))
     checkNEWS(file = file.path(R.home(), "NEWS"))

_A_r_g_u_m_e_n_t_s:

    file: the name of the file which the data are to be read from.
          Alternatively, 'file' can be a 'connection', which will be
          opened if necessary, and can also be a complete URL.  For
          more details, see the 'file' argument of 'read.table'.

   trace: logical indicating if the recursive reading should be traced,
          i.e., print what it is doing.

    chop: a character string specifying how the news entries should be
          _chopped_; 'chop = "keepAll"' saves the full entries.

_D_e_t_a_i_l_s:

     'readNEWS()' reads a NEWS file; 'checkNEWS()' checks for common
     errors in formatting.  Currently it detects an incorrect number of
     spaces before the '"o"' item marker.

_V_a_l_u_e:

     'readNEWS()' returns an (S3) object of class '"newsTree"';
     effectively a 'list' of lists which is a tree of NEWS entries.

     'checkNEWS()' returns 'TRUE' if no suspected errors are found, or
     prints a message for each suspected error and returns 'FALSE'.

     Note that this is still experimental and may change in the future.

_E_x_a_m_p_l_e_s:

     NEWStr  <- readNEWS(trace = TRUE)# chop = "first" ( = "first non-empty")
     ## keep the full NEWS entry text i.e. "no chopping":
     NEWStrA <- readNEWS(chop = "keepAll")
     object.size(NEWStr)
     object.size(NEWStrA) ## (no chopping) ==> about double the size

     str(NEWStr, max.level = 3)

     str(NEWStr[[c("2.3", "2.3.1")]], max.level=2, vec.len=1)

     NEWStr [[c("2.3", "2.3.1", "NEW FEATURES")]]
     NEWStrA[[c("2.4", "2.4.0", "NEW FEATURES")]]

     # Check the current NEWS file

     stopifnot(checkNEWS())

