3

i have the following dummy data.frame for which I'd like to create a summary using tableby

require(arsenal)

set.seed(12345)
df<-data.frame(var1=floor(runif(10,1000000,5000000)), var2=floor(runif(10,2500000,1000000000)), group=rep(c("A","B"),5))
desTab<-tableby(group~., data = df)
summary(desTab, digits = 0)

The output does not include any separators for the thousands ( "," ). This makes it rather unreadable.

How can I change it?

I played with

tableby.control()

But with no success.

Thanks for your help!

Juan
  • 171
  • 1
  • 12
  • R does not do that. If you write `3.000` that means `3`. You can add commas (see [here](https://stackoverflow.com/questions/29465941/format-number-in-r-with-both-comma-thousands-separator-and-specified-decimals)), i.e. `3,000` but then this will make them strings. So maybe you can use scientific notation, i.e. 3000000 = 3x10^6... – Sotos Jan 07 '20 at 10:05
  • Sorry, I meant "," as a separator. Its corrected in the question – Juan Jan 07 '20 at 10:14
  • So you don't mind If they are converted to strings? – Sotos Jan 07 '20 at 10:21
  • No. if its only for the table output – Juan Jan 07 '20 at 10:25

0 Answers0