Exporting tables

  • Exporting tables

     David updated 2 days, 13 hours ago 2 Members · 7 Posts
  • daisy.grewal

    Member
    October 13, 2020 at 3:48 pm

    Sorry for the newbie question, but is there a way to export nicely made tables into R Markdown (e.g. using formattable) as images, similar how you can do so with figures? I realize this isn’t an ideal thing to do, but it’s something I often end up needing to do. Thank you in advance.

  • David

    Organizer
    October 14, 2020 at 5:53 am

    Great question, Daisy! You can do this in two packages that I’m familiar with: gt and flextable. I actually did this in a package I developed for a client. Sometimes you have to go with workarounds for odd reasons!

    • daisy.grewal

      Member
      October 18, 2020 at 11:35 am

      Thank you so much!

    • daisy.grewal

      Member
      October 18, 2020 at 3:35 pm

      Hi David,

      If you see this, I’m totally stuck on a flextable question – I have a table where every row is a group. Each column shows the mean at a particular time point, and then I have a final column that’s the overall mean across all time points. Is there any way I can do conditional formatting on the row values based on the overall mean value in the final column? I’ve been stuck on this over an hour and ready to give up and do it by hand!

      Thanks for any advice,

      Daisy

  • David

    Organizer
    October 19, 2020 at 2:32 pm

    Sorry, just seeing this! Any chance we could go over it on Friday during the office hours session?

    • daisy.grewal

      Member
      October 19, 2020 at 2:37 pm

      I’ll try to make it on Friday! But I figured out a solution, not sure if there is a more elegant one: I created a column that subtracts the mean from the value I’m interested in comparing. Then I wrote a formula for color that shades the value if the column difference is > 0. Finally, I used col_keys to only display the columns with the shaded values (and not the calculated difference columns). Probably a little clumsy but it worked…

      • David

        Organizer
        October 19, 2020 at 2:39 pm

        Ok, sounds good!

Log in to reply.

Original Post
0 of 0 posts June 2018
Now
The R for the Rest of Us community is live! Join regular office hours, ask questions in the forum, and more!