checkingBookSources         package:RbcBook1         R Documentation

_F_o_r_m_a_t_t_i_n_g _a_n_d _s_t_a_n_d_a_r_d_i_z_a_t_i_o_n _c_h_e_c_k_s _o_n _b_o_o_k _c_h_a_p_t_e_r_s

_D_e_s_c_r_i_p_t_i_o_n:

     Formatting and standardization checks on book chapters

_U_s_a_g_e:

     checkVerbatim(files = .RbcBook1Files(ext=".tex"),
                    maxc = 70,
                   which = "both",
                 verbose = TRUE)

     checkRnw(files = .RbcBook1Files(),
            verbose = TRUE, stopOnError=FALSE)

     checkPackage(files = .RbcBook1Files(ext=".Rnw"),
                verbose = TRUE)

     .RbcBook1Files(ext=".Rnw")

_A_r_g_u_m_e_n_t_s:

   files: character vector with names (and path) of chapter source
          files

     ext: character of length 1. File name extension. '.Rnw' (the
          default) and '.tex' should be the most important cases.

    maxc: integer of length 1. Maximal number of characters in a
          verbatim line. All lines exceeding this limit will be
          reported in the return value of this function.

   which: character of length 1. 'Sinput' will look at 'Sinput'
          environments, 'Soutput' at 'Soutput' environments, 'both' at
          both.

 verbose: Logical.

stopOnError: Logical. If FALSE, first error found will lead to stop. If
          TRUE, try to continue checking.

_D_e_t_a_i_l_s:

     'checkVerbatimLines' sees whether all verbatim lines have length
     at most 'maxc'.

     'checkPackage' finds all the occurences of \Rpackage{...} in the
     text, checks whether the package is known, and returns a named
     list will all occurences of the packages.

_V_a_l_u_e:

     For 'checkVerbatimLines' and 'checkSetup', a data frame with one
     row for each offending line and various columns describing it.

     For '.RbcBook1Files', a character vector.

_A_u_t_h_o_r(_s):

     Wolfgang Huber <huber@ebi.ac.uk>

_E_x_a_m_p_l_e_s:

       f = tempfile()
       zap = function(n) paste(formatC(1:n, width=2), collapse=" ")
       writeLines(c("*begin{Sinput}", zap(20), zap(30), "*end{Sinput}"), con=f)
       checkVerbatim(files=f)

