dc {cwhstring} | R Documentation |
Replace "." in a number by "&" for LaTeX tables using column specification r@{.}l
dc (x,d,ch="&") dcn(x,d,ch="&")
x |
Numerical vector. |
d |
If not missing, determines number of decimals after ".". d >= 0 |
ch |
Substitute "." by ch |
string representation of x
suitable for table column centered
on "."
d
missing is an error. dcn(x,0)
does not serve its
intended purpose, see examples!
dc
and dcn
produce identical results for d >
0
, but not for d <= 0
, see \examples
.
Christian W. Hoffmann, christian.hoffmann@wsl.ch,
http://www.wsl.ch/staff/christian.hoffmann
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"