Is there a function in R to display large numbers separated with commas?
i.e., from 1000000 to 1,000,000.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can try either format or prettyNum, but both functions return a vector of characters. I’d only use that for printing.
EDIT: As Michael Chirico says in the comment:
Be aware that these have the side effect of padding the printed strings with blank space, for example:
Add
trim=TRUEtoformatorpreserve.width="none"toprettyNumto prevent this: