frac {cwhmisc} | R Documentation |
Split off fractional part of a number
frac(x,d)
x |
Numerical vector. |
d |
If not missing, determines number of decimals after "." |
fractional part, if d
is missing; else
round(10^d*fractional part), i.e. the digits without the leading "0.".
d
not missing is practical for use in dc
Christian W. Hoffmann <c-w.hoffmann@sunrise.ch>
http://www.wsl.ch/personal_homepages/hoffmann/index_EN
frac(c(0,pi,2*pi,30*pi)) # 0.000000 0.141593 0.283185 0.247780 frac(c(0,pi,2*pi,30*pi),3) # 0 142 283 248