Hi, I noted that, roughly since the first updates of the Org 9.7.x series, ob-R.el produces outputs that have alignment issues in the first line of the output, if and only if the code block includes several lines of code.
For instance, here is a code block including two lines of R code. As you can see, in the output, the first line has a wrong alignment of column names (all spaces being removed before the first word, "Sepal.Length"): #+begin_src R :results output :session *R* :exports both data(iris) summary(iris) #+end_src #+RESULTS: #+begin_example Sepal.Length Sepal.Width Petal.Length Petal.Width Min. :4.300 Min. :2.000 Min. :1.000 Min. :0.100 1st Qu.:5.100 1st Qu.:2.800 1st Qu.:1.600 1st Qu.:0.300 Median :5.800 Median :3.000 Median :4.350 Median :1.300 Mean :5.843 Mean :3.057 Mean :3.758 Mean :1.199 3rd Qu.:6.400 3rd Qu.:3.300 3rd Qu.:5.100 3rd Qu.:1.800 Max. :7.900 Max. :4.400 Max. :6.900 Max. :2.500 Species setosa :50 versicolor:50 virginica :50 #+end_example However, the output is correct if the code block is composed of one single line of R code: #+begin_src R :results output :session *R* :exports both summary(iris) #+end_src #+RESULTS: #+begin_example Sepal.Length Sepal.Width Petal.Length Petal.Width Min. :4.300 Min. :2.000 Min. :1.000 Min. :0.100 1st Qu.:5.100 1st Qu.:2.800 1st Qu.:1.600 1st Qu.:0.300 Median :5.800 Median :3.000 Median :4.350 Median :1.300 Mean :5.843 Mean :3.057 Mean :3.758 Mean :1.199 3rd Qu.:6.400 3rd Qu.:3.300 3rd Qu.:5.100 3rd Qu.:1.800 Max. :7.900 Max. :4.400 Max. :6.900 Max. :2.500 Species setosa :50 versicolor:50 virginica :50 #+end_example Thanks! Frédéric Emacs : GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.0) Package: Org mode version 9.7.15 (9.7.15-a1df10 @ /home/fsantos/.emacs.d/elpa/org-9.7.15/) current state: ============== (setq org-link-elisp-confirm-function 'yes-or-no-p org-cite-insert-processor 'citar org-reverse-datetree-find-function 'org-reverse-datetree--find-or-insert org-bibtex-headline-format-function 'org-bibtex-headline-format-default org-log-done 'time org-fontify-done-headline nil org-log-into-drawer t org-babel-after-execute-hook '(org-display-inline-images) org-persist-after-read-hook '(org-element--cache-persist-after-read) org-export-before-parsing-hook '(org-attach-expand-links) org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-archive-hook '(org-attach-archive-delete-maybe) org-cite-follow-processor 'citar org-file-apps '(("\\.pdf\\'" . emacs) (auto-mode . emacs) (directory . emacs) ("\\.mm\\'" . default) ("\\.x?html?\\'" . default) ("\\.pdf\\'" . default)) org-log-reschedule 'note org-noter--pretty-print-location-for-title-hook '(org-noter-djvu--pretty-print-location org-noter-nov--pretty-print-location org-noter-pdf--pretty-print-location-for-title) org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function org-edit-src-content-indentation 0 org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS WIDTH)"] org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines org-cycle-optimize-window-after-visibility-change org-cycle-display-inline-images) org-latex-minted-langs '((SAS "sas") (R "r") (emacs-lisp "common-lisp") (cc "c++") (cperl "perl") (shell-script "bash") (caml "ocaml")) org-persist-before-read-hook '(org-element--cache-persist-before-read) org-modules '(ol-doi ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus ol-info ol-irc ol-mhe ol-rmail ol-eww org-habit) org-habit-preceding-days 30 org-yank-image-file-name-function 'org-yank-image-autogen-filename org-starter-alternative-find-function 'org-starter-sparse-tree-on-file org-noter--pretty-print-highlight-location-hook '(org-noter-pdf--pretty-print-highlight) org-mode-hook '(tempel-setup-capf #[0 "\301\211\207" [imenu-create-index-function org-imenu-get-tree] 2] org-fragtog-mode (lambda nil (local-set-key (kbd "C-u C-c C-x C-a") #'org-reverse-datetree-archive-subtree)) org-display-inline-images turn-on-visual-line-mode (lambda nil (electric-indent-local-mode -1)) org-tempo-setup #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-fold-show-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes) org-babel-load-languages '((emacs-lisp . t) (latex . t) (org . t) (R . t) (shell . t)) org-noter--pretty-print-location-hook '(org-noter-djvu--pretty-print-location org-noter-nov--pretty-print-location org-noter-pdf--pretty-print-location) org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"] org-roam-db-node-include-function #[0 "\300\207" [t] 1] org-latex-format-headline-function 'org-latex-format-headline-default-function org-confirm-shell-link-function 'yes-or-no-p org-reveal-start-hook '(org-decrypt-entry) org-adapt-indentation 'headline-data org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"] outline-isearch-open-invisible-function 'outline-isearch-open-invisible org-after-todo-statistics-hook '(org-summary-todo) org-sort-function 'string-collate-lessp org-odt-format-headline-function 'org-odt-format-headline-default-function org-roam-capture-preface-hook '(org-roam-capture--try-capture-to-ref-h) org-agenda-before-write-hook '(org-agenda-add-entry-text) org-capture-prepare-finalize-hook '(org-roam-capture--install-finalize-h) org-src-preserve-indentation t org-latex-packages-alist '(("" "color")) org-roam-preview-function 'org-roam-preview-default-function org-babel-tangle-lang-exts '(("latex" . "tex") ("emacs-lisp" . "el") ("elisp" . "el")) org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-roam-db-autosync-mode t org-checkbox-statistics-hook '(fs/org-checkbox-auto-close) org-confirm-elisp-link-function 'yes-or-no-p org-latex-src-block-backend 'minted org-log-buffer-setup-hook '(org-roam-log--setup) org-cite-activate-processor 'citar org-todo-keywords '((sequence "TODO(t)" "IN-PROGRESS(p)" "SOMEDAY(s)" "WAITING(w@)" "REVIEW(r)" "|" "DONE(d)" "CANCELED(c@)")) org--warnings nil org-roam-capture-new-node-hook '(orb--insert-captured-ref-h org-roam-capture--insert-captured-ref-h) org-structure-template-alist '(("init" . "src emacs-lisp :tangle init.el") ("el" . "src emacs-lisp :results output") ("o" . "src octave :results output :session :exports both") ("jtab" . "src ess-julia :results value table :session *julia* :exports both :colnames yes") ("jfig" . "src ess-julia :results output graphics file :file FILENAME.png :session *julia* :exports both") ("j" . "src ess-julia :results output :session *julia* :exports both") ("einp" . "src ein-python :results output :session localhost :exports both") ("pfig" . "src python :results file :session :exports both :var plot_filename='FILENAME.png'\nimport matplotlib.pyplot as plt\n\nplt.savefig(plot_filename)\nplot_filename") ("ip" . "src ipython :results output :session ip1 :exports both") ("p" . "src python :results output :session :exports both") ("rtab" . "src R :results value table :colnames yes :rownames yes :session *R* :exports both") ("rfig" . "src R :results graphics file :file FILENAME.png :exports both :width 600 :height 400 :session *R*") ("r" . "src R :results output :session *R* :exports both") ("a" . "export ascii") ("c" . "center") ("C" . "comment") ("e" . "example") ("E" . "export") ("h" . "export html") ("l" . "export latex") ("q" . "quote") ("s" . "src") ("v" . "verse")) org-blocker-hook '(org-block-todo-from-children-or-siblings-or-parent) org-noter--show-arrow-hook '(org-noter-pdf--show-arrow) org-pretty-entities t org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default org-habit-today-glyph 46 org-habit-following-days 0 org-roam-bibtex-mode t org-journal-mode-hook '(turn-on-visual-line-mode org-journal-default-enable-encryption) org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"] org-noter--add-highlight-hook '(org-noter-pdf--highlight-location) org-noter--get-current-view-hook '(org-noter-djvu--get-current-view org-noter-nov--get-current-view org-noter-pdf--get-current-view) org-enforce-todo-dependencies t org-noter-set-up-document-hook '(org-noter-djvu--setup-handler org-noter-nov--setup-handler org-noter-pdf--doc-view-setup-handler org-noter-pdf--pdf-view-setup-handler) org-confirm-babel-evaluate nil org-noter--get-containing-element-hook '(org-noter--get-containing-heading org-noter--get-containing-property-drawer) org-fold-core-isearch-open-function 'org-fold--isearch-reveal org-export-with-smart-quotes t org-cite-export-processors '((beamer natbib) (latex natbib) (html csl) (t basic)) org-latex-caption-above nil org-latex-format-inlinetask-function 'org-latex-format-inlinetask-default-function org-noter--convert-to-location-cons-hook '(org-noter-pdf--convert-to-location-cons) org-persist-before-write-hook '(org-element--cache-persist-before-write) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-link-shell-confirm-function 'yes-or-no-p org-babel-pre-tangle-hook '(save-buffer) org-journal-file-type 'monthly org-agenda-loop-over-headlines-in-active-region nil org-todo-keyword-faces '(("TODO" . "red3") ("IN-PROGRESS" . "DarkOrange2") ("SOMEDAY" . "blue") ("WAITING" . "gold2") ("REVIEW" . "purple") ("CANCELED" . "thistle4") ("DONE" . "forest green")) org-noter--get-precise-info-hook '(org-noter-djvu--get-precise-info org-noter-nov--get-precise-info org-noter-pdf--doc-view-get-precise-info org-noter-pdf--pdf-view-get-precise-info) org-fold-reveal-start-hook '(org-decrypt-entry) org-noter--get-highlight-location-hook '(org-noter-pdf--get-highlight) org-occur-hook '(org-first-headline-recenter) org-capture-after-finalize-hook '(orb-make-notes-cache) org-roam-log-setup-hook '(org-roam--register-completion-functions-h) org-metadown-hook '(org-babel-pop-to-session-maybe) org-noter--doc-approx-location-hook '(org-noter-djvu--approx-location-cons org-noter-nov--approx-location-cons org-noter-pdf--approx-location-cons) org-roam-node-annotation-function 'org-roam-node-read--annotation org-link-parameters '(("mu4e" :follow mu4e-org-open :store mu4e-org-store-link) ("eww" :follow org-eww-open :store org-eww-store-link) ("rmail" :follow org-rmail-open :store org-rmail-store-link) ("mhe" :follow org-mhe-open :store org-mhe-store-link) ("irc" :follow org-irc-visit :store org-irc-store-link :export org-irc-export) ("info" :follow org-info-open :export org-info-export :store org-info-store-link :insert-description org-info-description-as-command) ("gnus" :follow org-gnus-open :store org-gnus-store-link) ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link) ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link) ("w3m" :store org-w3m-store-link) ("doi" :follow org-link-doi-open :export org-link-doi-export) ("roam" :follow org-roam-link-follow-link) ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link) ("attachment" :follow org-attach-follow :complete org-attach-complete-link) ("id" :follow org-roam-id-open :store org-id-store-link-maybe) ("file+sys") ("file+emacs") ("shell" :follow org-link--open-shell) ("news" :follow #[514 "\301\300\302Q\"\207" ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"]) ("mailto" :follow #[514 "\301\300\302Q\"\207" ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"]) ("https" :follow #[514 "\301\300\302Q\"\207" ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"]) ("http" :follow #[514 "\301\300\302Q\"\207" ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"]) ("ftp" :follow #[514 "\301\300\302Q\"\207" ["ftp" browse-url ":"] 6 "\n\n(fn URL ARG)"]) ("help" :follow org-link--open-help :store org-link--store-help) ("file" :complete org-link-complete-file) ("elisp" :follow org-link--open-elisp)) org-journal-prefix-key "C-c j " org-noter-get-buffer-file-name-hook '(org-noter-nov--get-buffer-file-name org-noter-pdf--get-buffer-file-name) org-html-format-headline-function 'org-html-format-headline-default-function org-metaup-hook '(org-babel-load-in-session-maybe) org-noter-get-selected-text-hook '(org-noter-djvu--get-selected-text org-noter-nov--get-selected-text org-noter-pdf--get-selected-text) org-noter-create-session-from-document-hook '(org-noter--create-session-from-document-file-default) org-latex-pdf-process '("latexmk -shell-escape -bibtex -f -pdf %f") org-habit-completed-glyph 10003 org-tags-column 0 org-src-lang-modes '(("beamer" . LaTeX) ("latex" . LaTeX) ("C" . c) ("C++" . c++) ("asymptote" . asy) ("beamer" . latex) ("calc" . fundamental) ("cpp" . c++) ("ditaa" . artist) ("desktop" . conf-desktop) ("dot" . fundamental) ("elisp" . emacs-lisp) ("ocaml" . tuareg) ("screen" . shell-script) ("sqlite" . sql) ("toml" . conf-toml) ("shell" . sh) ("ash" . sh) ("sh" . sh) ("bash" . sh) ("jsh" . sh) ("bash2" . sh) ("dash" . sh) ("dtksh" . sh) ("ksh" . sh) ("es" . sh) ("rc" . sh) ("itcsh" . sh) ("tcsh" . sh) ("jcsh" . sh) ("csh" . sh) ("ksh88" . sh) ("oash" . sh) ("pdksh" . sh) ("mksh" . sh) ("posix" . sh) ("wksh" . sh) ("wsh" . sh) ("zsh" . sh) ("rpm" . sh)) org-tab-before-tab-emulation-hook '(org-tempo-complete-tag) org-archive-reversed-order t org-roam-indirect-buffer-hook '(org-roam--register-completion-functions-h) org-clock-into-drawer "CLOCKING" org-journal-file-format "%Y%m%d.org" org-noter-create-skeleton-functions '(org-noter-djvu--create-skeleton org-noter-nov--create-skeleton-epub org-noter-pdf--create-skeleton) org-archive-subtree-save-file-p t org-list-allow-alphabetical t )