dc                 package:cwhstring                 R Documentation

_C_o_n_v_e_r_t _n_u_m_b_e_r _f_o_r _u_s_e _i_n _d_e_c_i_m_a_l _d_o_t _c_e_n_t_e_r_e_d _t_a_b_l_e _c_o_l_u_m_n_s

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

     Replace "." in a number by "&" for LaTeX tables using column
     specification r\@{.}l

_U_s_a_g_e:

       dc (x,d,ch="&")
       dcn(x,d,ch="&")

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

       x: Numerical vector.

       d: If not missing, determines number of decimals after ".". d >=
          0

      ch: Substitute "." by ch

_V_a_l_u_e:

     string representation of 'x' suitable for table column centered on
     "."

_W_a_r_n_i_n_g:

     'd' missing is an error. 'dcn(x,0)' does not serve its intended
     purpose, see examples!

_N_o_t_e:

     'dc' and 'dcn' produce identical results for 'd > 0', but not for
     ' d <= 0 ', see '\examples'.

_A_u_t_h_o_r(_s):

     Christian W. Hoffmann, christian.hoffmann@wsl.ch, 
      <URL: http://www.wsl.ch/staff/christian.hoffmann>

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

       dc (c(0,pi,2*pi,-30*pi),3)   # "0&0"     "3&142"   "6&283"   "-94&248"
       dcn(c(0,pi,2*pi,-30*pi),3)   # "0&000"   "3&142"   "6&283"   "-94&248"
     #  d = 0:
       dc (c(0,pi,2*pi,-30*pi),0)   # "0&0"  "3&0"  "6&0"  "-94&0"
       dcn(c(0,pi,2*pi,-30*pi),0)   # "0"    "3"    "6"    "-94",  beware !
     #  d < 0:
       dc (c(0,pi,2*pi,-30*pi),-3)  # "0&0"    "3&0"    "6&0"    "-94&0"
       dcn(c(0,pi,2*pi,-30*pi),-3)  # "0&000"  "3&142"  "6&283"  "-94&248"

