debugging littler/Rscripts

后端 未结 3 1739
自闭症患者
自闭症患者 2021-02-09 08:08

How do I debug Rscripts that are run from the command line?

I am currently using the getopt package to pass command line options, nut when the

3条回答
  •  不要未来只要你来
    2021-02-09 08:48

    Another option is to work with the options(error) functionality. Here's a simple example:

    options(error = quote({dump.frames(to.file=TRUE); q()}))
    

    You can create as elaborate a script as you want on an error condition, so you should just decide what information you need for debugging.

    Otherwise, if there are specific areas you're concerned about (e.g. connecting to a database), then wrap them in a tryCatch() function.

提交回复
热议问题