Skip to content
Prev 310289 / 398503 Next

Formatting digits in a table with mix of numbers and characters

On Nov 8, 2012, at 8:14 AM, Brian Hobbs wrote:

            
Appears from your desired output that your interpretation of "significant digits differs from that of the format function's implementation. (See below)
I cannot think of any at the moment.
Not sure.
Warning messages:
1: In ifelse(!is.na(as.numeric(table)), format(as.numeric(table), digits = 4),  :
  NAs introduced by coercion
2: In format(as.numeric(table), digits = 4) : NAs introduced by coercion
[,1]     [,2]     [,3]    
[1,] " 12.35" "--"     " 10.00"
[2,] " 12.35" "--"     "NA"    
[3,] "--"     "123.46" "--"