#+BEGIN_SRC emacs-lisp :results silent (defun group-number (num &optional size char) "Format NUM as string grouped to SIZE with CHAR." ;; Based on code for `math-group-float' in calc-ext.el (let* ((size (or size 3)) (char (or char ",")) (str (if (stringp num) (number-to-string (string-to-number (replace-regexp-in-string "," "" num))) (number-to-string num))) (pt (or (string-match "[^0-9a-zA-Z]" str) (length str)))) (while (> pt size) (setq str (concat (substring str 0 (- pt size)) char (substring str (- pt size))) pt (- pt size))) str)) #+END_SRC The following code block will call the group-number Emacs Lisp function on every cell in its input argument which is a number. #+name: table-number-grouper #+BEGIN_SRC emacs-lisp :var data='() (mapcar (lambda (row) (if (equalp row 'hline) 'hline (mapcar (lambda (cell) (if (numberp cell) (group-number cell) cell)) row))) data) #+END_SRC Here's a simple shell code block which produces the table (this is a stand in for your R code block). #+begin_src sh cat <