One quick way of achieving this is terminating the R session.
x <- "test" if (!is.numeric(x)) { stop("Not numeric") # To see reason for failure q(save = "no") } print("hello world")