r - Make a function output different results depending on rmarkdown output format -
i've created small function which, given table argument, outputs html allows display different views of table tabbed interface.
the problem is, works nicely when rendering html document, breaks if want generate pdf. solution make function aware of current rmarkdown output format make output correct code. :
function() { if (current_output_format=="html") output_something_in_html() if (current_output_format=="pdf") output_something_in_latex() }
so there way determine, when calling render()
, output format rendered ?
thanks in advance help.
what catching error , dealing in sensible way. like:
ans = try(do_default(), true) if(class(ans)== "try-error") ans = do_fall_back()
still not best solution, @ least it's portable.
Comments
Post a Comment