when displaying a number with inline-code with more than four digits like
`r 21645`
the result in a knitted html-file is this: 2.164510^{4}
(in reality inside the inline-hook there is a calculation going on which results in 21645). Even though I just want it to print the number, like so: 21645
. I can easily fix this for one instance wrapping it inside as.integer
or format
or print
, but how do I set an option for the whole knitr-document so that it prints whole integers as such (all I need is to print 5 digits)? Doing this by hand gets very annoying. Setting options(digits = 7)
doesnt help. I am guessing I would have to set some chunk-optionor define a hook, but I have no idea how
Note that if you type your numeric as integer it will be well formatted:
Of course you can always set an inline hook for more flexibility( even it is better to set globally options as in your answer):