tryCatch in R [Software]
Hi ElMaestro,
maybe I misunderstood your goal but won't
work?
❝ You can try the following simpler example:
❝ a=system(command="hamburger", intern=T)
❝ The following is printed to the console:
❝ sh: 1: hamburger: not found
❝ 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
Kind regards,
Mittyri
Complete thread:
- system and system2 in R ElMaestro 2022-08-29 22:29 [Software]
- system and system2 in R Helmut 2022-08-30 01:10
- system and system2 in R ElMaestro 2022-08-30 08:52
- system and system2 in R Helmut 2022-08-30 11:25
- processx package mittyri 2022-08-31 17:50
- system and system2 in R ElMaestro 2022-08-30 08:52
- tryCatch in Rmittyri 2022-08-31 17:53
- tryCatch in R ElMaestro 2022-09-01 10:33
- tryCatch in R mittyri 2022-09-01 14:07
- tryCatch in R ElMaestro 2022-09-01 10:33
- system and system2 in R Helmut 2022-08-30 01:10