## tryCatch in R [Software]

Hi ElMaestro,

❝ You can try the following simpler example:

a=system(command="hamburger", intern=T)

❝ The following is printed to the console:

❝ Error in system(command = "hamburger", intern = T) :

❝ error in running command

❝ But this isn't the content of the variable a as I was hoping. Note that in this example, an error is produced but not in the R sense, only in the system (or system2) sense. Thus, there is no gain in putting the code into try{} brackets.

maybe I misunderstood your goal but won't
tryCatch(   {        a <- system(command="hamburger", intern = T)   },    error = function(cond) {     a <<- cond   } )
work?

Kind regards,
Mittyri