

format {base}                                R Documentation

_E_n_c_o_d_e _i_n _a _C_o_m_m_o_n _F_o_r_m_a_t

_D_e_s_c_r_i_p_t_i_o_n_:

     Format an R object for pretty printing: `format.pval'
     is intended for formatting p-values.

_U_s_a_g_e_:

     format(x, ...)
     format.default(x, trim=FALSE, digits = .Options$digits)
     format.pval(x, digits= max(1,.Options$digits-2), eps = .Machine$double.eps)

_A_r_g_u_m_e_n_t_s_:

       x: any R object (conceptually); typically numeric.

    trim: logical; if `TRUE', leading blanks are trimmed off
          the strings.

  digits: how many significant digits are to be used for
          `numeric x'. This is a suggestion: enough decimal
          places will be used so that the smallest (in mag-
          nitude) number has this many significant digits.

_D_e_t_a_i_l_s_:

     These functions convert their first argument to a vec-
     tor (or array) of character strings which have a common
     format (as is done by `print').  The trimming with
     `trim = TRUE' is useful when the strings are to be used
     for plot `axis' annotation.

     `format.pval' is mainly an auxiliary function for
     `print.summary.lm' etc., does separate formatting for
     fixed, floating point and very small values (those `<
     eps').

     The function `formatC' provides a rather more flexible
     formatting facility for numbers, does not provide a
     common format for several numbers, however.

_S_e_e _A_l_s_o_:

     `formatC', `paste', `as.character'.

_E_x_a_m_p_l_e_s_:

     format(1:10)

     p <- c(47,13,2,.1,.023,.0045, 1e-100)/1000
     format.pval(p)
     format.pval(p / 0.9)
     format.pval(p / 0.9, dig=3)

