A lot of the time I paste code for evaluation into the R console. Sometimes errors occur in the middle of the statements I pasted and I miss them because they blend in with the rest of the stuff on the screen. Is there a way to make them stand out via color coding?
相关问题
- R - Quantstart: Testing Strategy on Multiple Equit
- Using predict with svyglm
- Reshape matrix by rows
- Extract P-Values from Dunnett Test into a Table by
- split data frame into two by column value [duplica
相关文章
- How to convert summary output to a data frame?
- How to plot smoother curves in R
- Paste all possible diagonals of an n*n matrix or d
- ess-rdired: I get this error “no ESS process is as
- How to use doMC under Windows or alternative paral
- dyLimit for limited time in Dygraphs
- Saving state of Shiny app to be restored later
- How to insert pictures into each individual bar in
I would suggest using RStudio. It has many color options for the console and file text that are really simple to change.
Here's how mine looks. It makes error, warnings, and messages really easy to spot.
On linux or mac, you can simply load the colorout package and your errors will show up in red.
Try these:
stop("an error occurred")
message("an error occurred")
cat("error occurred", file=stderr())
from
?base::options
error: either a function or an expression governing the handling of non-catastrophic errors such as those generated by stop as well as by signals and internally detected errors. If the option is a function, a call to that function, with no arguments, is generated as the expression. The default value is NULL: see stop for the behaviour in that case. The functions dump.frames and recover provide alternatives that allow post-mortem debugging. Note that these need to specified as e.g. options(error=utils::recover) in startup files such as ‘.Rprofile’.So, I guess you could modify your .Rprofile to handle errors differently, if stopping is too much maybe you can surround them with some line-breaks to make them stand out in your code.