JDA1115
JDA1115

Reputation: 31

Descriptive stats from stat.desc() is in scientific notation form

Lets say I have a data frame "example" of a bunch of random integers

example <- data.frame(Column1 = floor(runif(7, min = 1000, max = 7000)), 
                      column2 = floor(runif(7, min = 12000, max = 70000)))

I want to get a summary of the descriptive statistics of these columns so I use

stat.desc(example)

But the output of the descriptive statistics is in scientific notation form. I know I can do:

format(stat.desc(example), scientific = FALSE)

And it will convert it to non-scientific notation, but why is scientific notation the default output mode?

Upvotes: 3

Views: 2784

Answers (1)

sconfluentus
sconfluentus

Reputation: 4993

It is created that way. However, you can set the options:

options(scipen=100)
options(digits=3)
stat.desc(example)

This will produce output as you like without converting to decimals afterward. I've included rounding as it will likely be 6-7 digits without the rounding option. This would give you 3 decimal places and no scientific notation.

Upvotes: 4

Related Questions