Closed Dris101 closed 8 years ago
Not sure. Can you please provide a use case when this would be useful? Currently, you can achieve this behavior by not having column names, e.g.:
> pander(unname(head(mtcars)))
----------------------- ---- - --- --- ---- ----- ----- - - - -
**Mazda RX4** 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
**Mazda RX4 Wag** 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
**Datsun 710** 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
**Hornet 4 Drive** 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1
**Hornet Sportabout** 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2
**Valiant** 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
----------------------- ---- - --- --- ---- ----- ----- - - - -
My use case was a bit weird. I wanted a table with a blank placeholder column. When I set the names
to NULL
, columns containing only whitespace are removed. Not worth you wasting a lot of time on this! It is something of an edge case! Great package by the way. Many thanks for your work.
> df <- data.frame(a=1:3, b=rep(" ",3), c=1:3)
> pander(df)
-----------
a b c
--- --- ---
1 1
2 2
3 3
-----------
> pander(unname(df))
- -
1 1
2 2
3 3
- -
Thanks for the example, now I see what's the problem. Unfortunately, this requires a further workaround, as pander
removes empty columns (as the width of that is zero). But if you fill in the placeholder column with e.g. a non-breaking space, it should work:
> df <- data.frame(a = 1:3, b = ' ', c = 1:3)
> pander(unname(df))
- ------ -
1 1
2 2
3 3
- ------ -
Although I'd rather handle that at the print level:
> df <- data.frame(a = 1:3, b = NA, c = 1:3)
> pander(unname(df), missing = ' ')
- ------ -
1 1
2 2
3 3
- ------ -
Please let me know how this works for you. Meanwhile, I'll work on #224 (should be fixed in 24 hrs).
@Dris101, does the above example works for you as a workaround?
I suppose the above suggested workaround works fine, please reopen if not.
Would it be possible to be able to pass a flag to
pandoc.table
to explicitly request a headerless multiline table?