Let the data.frame
object x
below
x <- data.frame(y = seq(0, 1, by = .1),
z = letters[1:11])
which can be summarized as follows:
> summary(x)
y z
Min. :0.00 a :1
1st Qu.:0.25 b :1
Median :0.50 c :1
Mean :0.50 d :1
3rd Qu.:0.75 e :1
Max. :1.00 f :1
(Other):5
I would like to print the summary above with 6 digits after the decimal point; the summary
function has a digits
argument, but running summary(x, digits = 6)
gives the same output (two digits after the decimal point). It looks like that argument controls for significant digits, but the documentation and my own ignorance about the topic confused me to the point where I am not even sure that's what's happening.
I've tried playing around with format
and formatC
, but I can't find a way to produce the output I want, i.e.:
y z
Min. :0.000000 a :1
1st Qu.:0.250000 b :1
Median :0.500000 c :1
Mean :0.500000 d :1
3rd Qu.:0.750000 e :1
Max. :1.000000 f :1
(Other):5