search for: secondpart

Displaying 1 result from an estimated 1 matches for "secondpart".

Did you mean: secondpartm
2006 Jun 08
1
Formatting numbers for printing
...would like to format them as follows: 012-012, i.e., the first two digits padded to the left by a zero, followed by a dash, followed by the final three digits, also padded to the left by zeros. I can do this with brute force: FirstPart <- sprintf("%03d", floor(Number / 1000)) SecondPart <- sprintf("%03d", WhichID %% 1000) Combined <- paste(FirstPart, "-", SecondPart, sep="") But, I suspect that there is some more clever means to accomplish this using formatC or sprintf. Unfortunately, the help pages don't provide sufficient insight....