4

I'm trying to use a notebook in RStudio for an interactive demonstration for students. I like the visual markdown editor, but I'm struggling to format the output.

I can't figure out why the width of the output table is not 100%. It looks fine in the source editor, but not in the visual editor, see screenshots.

visual editor

source editor

How can I increase the width of the table in the output? (Note: I mean in the dynamic output that shows up immediately after running the code, not in the knitted document or the automatically saved nb.html file.) I tried setting fig.width, width, table.width in the chunk options, but it doesn't change anything.

M4RT1NK4
  • 433
  • 1
  • 4
  • 9
  • What version of RStudio are you using? What you're describing sounds like this bug: https://github.com/rstudio/rstudio/issues/8531 -- which we don't have a reproducible case for but would welcome one! – Jonathan Feb 05 '22 at 00:18
  • RStudio version is 1.4.1103. I will try updating it, should've thought of that. It is exactly like the bug you mentioned, but I also wasn't able to reliably reproduce it, it worked fine one minute then suddenly it didn't and I'm not sure what caused it. I will let you know if I figure it out. – M4RT1NK4 Feb 05 '22 at 21:46
  • @Jonathan do you have any suggestion for a workaround to enable pretty tables in visual mode? – mihagazvoda Feb 09 '22 at 11:47

1 Answers1

-1

The kable() package does a good job of solving such problems. There is already a topic on this topic with lots of code examples.

NCC1701
  • 139
  • 11