Hi Ihor,

Thanks for your advice, it helps a lot.  Sorry for submitting something that wasn't a bug.

Paul

On Thu, 7 Mar 2024 at 13:16, Ihor Radchenko <yantar92@posteo.net> wrote:
Paul Stansell <paulstansell@gmail.com> writes:

> It seems that using ":var d=data" breaks ":colnames yes" in the header of
> an R code block.
> ...
> #+name: data
> |--------+--------|
> |      x |      y |
> |--------+--------|
> | 111.89 |  88.37 |
> | 392.12 | 297.33 |
> |--------+--------|

It is expected.
:colnames yes implies:

     The ‘colnames’ header argument accepts ‘yes’, ‘no’, or ‘nil’
     values.  The default value is ‘nil’: if an input table has column
     names--because the second row is a horizontal rule--then Org
     removes the column names, processes the table, puts back the column
     names, and then writes the table to the results block.  Using
     ‘yes’, Org does the same to the first row, even if the initial
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     table does not contain any horizontal rule.  When set to ‘no’, Org
     does not pre-process column names at all.

In your table, the first row is a horizontal line, so Org tries to parse
the first line as column names. And fails, of course.

I guess that we can make `org-babel-get-colnames' smarter and make it
skip the leading hlines.

--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>