How to wrap text in R source with tidy and knitr

后端 未结 3 1441
说谎
说谎 2021-02-20 06:05

I\'m working with knitr lately and while most aspects of that have gone quite smoothly, there\'s one formatting issue with including R code in the finished document that I haven

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-20 06:13

    This is an extremely manual solution, but one which I have used.

    You build the string up, using paste0 and that gives tidy a chance to split it.

    longstr <- paste0("This string will flow off the right side"," of the page, because tidy doesn't know how to wrap it.")
    

提交回复
热议问题