format.info               package:base               R Documentation

_f_o_r_m_a_t(.) _I_n_f_o_r_m_a_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Information is returned on how `format(x, digits =
     options("digits"))' would be formatted.

_U_s_a_g_e:

     format.info(x)

_A_r_g_u_m_e_n_t_s:

       x: (numeric) vector; potential argument of `format(x,...)'.

_V_a_l_u_e:

     An `integer' `vector' of length 3, say `r'. 

    r[1]: width (number of characters) used for `format(x)'

    r[2]: number of digits after decimal point.

    r[3]: in `0:2'; if >=`1', exponential representation would be used,
          with exponent length of `r[3]+1'.

_N_o_t_e:

     The result depends on the value of `options("digits")'.

_S_e_e _A_l_s_o:

     `format', `formatC'.

_E_x_a_m_p_l_e_s:

     dd <- options("digits") ; options(digits = 7) #-- for the following
     format.info(123) # 3 0 0
     format.info(pi)  # 8 6 0
     format.info(1e8) # 5 0 1 - exponential "1e+08"
     format.info(1e222)#6 0 2 - exponential "1e+222"

     x <- pi*10^c(-10,-2,0:2,8,20)
     names(x) <- formatC(x,w=1,dig=3,format="g")
     cbind(sapply(x,format))
     t(sapply(x, format.info))

     # Reset old options:
     options(dd)

