Displaying errors with sweave

前端 未结 3 1066
误落风尘
误落风尘 2021-01-05 00:19

I\'m writing some R notes with Sweave and would like to show common errors. For example,

<>=
x = 5
#Case matters!
x*X
@
         


        
3条回答
  •  旧巷少年郎
    2021-01-05 00:56

    As Shane suggests, use

    <> 
    

    for the code that will error, but you want to display, and then again with

    <> 
    

    but with the same code wrapped in a try.

    There's an example here: http://tolstoy.newcastle.edu.au/R/help/05/09/11690.html

提交回复
热议问题