nutterb / pixiedust

Tables So Beautifully Fine-Tuned You Will Believe It's Magic.
178 stars 18 forks source link

failure in beamer slides #81

Closed nutterb closed 7 years ago

nutterb commented 7 years ago

I received the following e-mail from a user:

I'm using the latest version of Pixiedust and R. I'm creating a beamer presentation but I get the following message

Error in print.dust(x): 'beamer' is not a valid print method

When I tried using something like the code below, I got the same error.

library(pixiedust)
options(pixiedust_print_method = "latex")

dust(mtcars) 

The reason this error is generated is that knitr::opts_knit$get("rmarkdown.pandoc.to") (https://github.com/nutterb/pixiedust/blob/master/R/dust.R#L255) returns "beamer". Since that is not NULL, the function never changes to the option value.

What should happen instead is that pixiedust should

  1. Check for the option, if it has an option, use it.
  2. If there is no option, call knitr::opts_knit$get("rmarkdown.pandoc.to")
  3. If that is still NULL, return "console"

I think the resolution would be

  1. Not set the option in zzz.R
  2. write a function to perform the steps above.