Saturday, 17 August 2013

Too long character string in knitr html output

Too long character string in knitr html output

My function bs.pi.gmp() defined here can produce very long character strings:
> bs.pi.gmp(8)
$Sn
Big Rational ('bigq') :
[1]
115056663317199981372832786803399641133848259535718238578854114440177847232763528127119686643465544336537363974090559640151844992619459739337642897335661405374200830442503779326745081494631228217510085926896107230240702464/73247346810369298651903071099557979072216039642432949710389234675732768750102001285974817825809831148661290123993641325086924401900965008305646606428886048721946203288377842830920059623434101646117412656625454480462852875
$eval.Sn
[1] "1.570796326794896557999"
When I run bs.pi.gmp(8) inside a RMarkdown document, then the string goes
beyond the width screen. I have tried to solve that using
options(width=...) or using tidy option in the chunk but that does not
work. How to solve that ?
However when I simply copy-paste the html produced by knitr on overblog
then, as you can see, the rendering is perfect. This is surely due to an
html option (in the header) produced when the article is published on the
blog, but what is this option ?

No comments:

Post a Comment