Hacking the R (HTML) Help Pages

Yihui Xie 2018-03-06

Early in January this year, the curious Colin Fay discovered with great surprise that someone managed to insert Clippy (the classic Office Assistant) to the R help page of writexl::write_xlsx()!

Clippy on an R help page

Well, whenever I see hacks that are funny or unbelievable, I’d first guess it would be either Jeroen Ooms or Romain Francois — who else could be more creative than them in the R community in terms of hacking skills? :) This time it was the ninja Jeroen. The key was to use \if{html}{} to insert arbitrary HTML code to an R help page.

This morning I learned another amazing hack from Noam Ross, and the hack was even deeper and darker, which used \Sexpr{} inside \if{html}{}. He actually inserted an HTML widget (via DT) to an R help page!

Oh my… You hackers are so awesome

Update on 2018-08-01

I discovered yoni sidi’s <details> hack.