0

The output from the reprex package involving html tables don't format correctly when pasting into stackoverflow. Is there an extra step I have to take?

Here's an example. This command sends the character data to the clipboard.

reprex::reprex({
  gt::gt(head(iris))
})

When I paste it to stackoverflow, I see this preview (a mess of raw html instead of a formatted table).

reprex output

Arthur
  • 1,248
  • 8
  • 14
  • What exactly do you want the output to be? Is there a reason you are trying to use `gt` in the reproducible example? Is that where the error occurs or are you just trying to format the output? – MrFlick Oct 26 '22 at 20:36
  • I want the output to be an html table. There is no reason for `gt` in particular - the same problem exists for `kable` tables. There is no R error that occurs. The issue is that the output does not format correctly in stackoverflow. – Arthur Oct 26 '22 at 20:44
  • Stack Overflow doens't support gt tables or kable tables. Those use HTML or latex for formatting. It has it's own syntax for tables. You can use `repex(..., venue="so")`. It's almost always better to share a `dput()` of your data than a crazy formatted version of it when asking for help. – MrFlick Oct 26 '22 at 20:47
  • I don't need a `dput`, because my data is `iris`. – Arthur Oct 26 '22 at 20:51
  • I tried this command as you suggested `reprex::reprex({gt::gt(head(iris))}, venue = "so")`, but I receive a message "The Stack Overflow venue "so" is an alias for the default GitHub venue "gh". There is no need to specify the venue.", and I experience the same issue when pasting into stackoverflow. – Arthur Oct 26 '22 at 20:54

0 Answers0