I know it might seem as a trivial question but I tried really hard to find solution and it was impossible. Assume I have a data frame like this where one column contatins big numbers:
Id Value
1 2158456456456.78
2 123354554.24
3 72323211215.77
I want to put that data frame into latex document using function xtable but I don't want the table to display the numbers like above but in a formatted way like this:
Id Value
1 2 158 456 456 456.78
2 123 354 554.24
3 72 323 211 215.77
Any ideas?
you can try
options(scipen = 100) # to remove exponential notation
df$val <- prettyNum(df$Value, big.mark=" ")
Id Value val
1 1 2158456456457 2 158 456 456 457
2 2 123354554 123 354 554
3 3 72323211216 72 323 211 216
'scipen': A penalty to be applied when deciding to print numeric values in fixed or exponential notation.