Mahesha999 Mahesha999 - 3 months ago 7
R Question

try() in R not continuing execution on exception

I am new to R, and learning it online by trying out some simple code

I read

try()
allows to ignore any error and continue. So I tried this:

enter image description here

When I put
log()
inside
try()
, I was still getting the same output;

enter image description here

I was expecting something like:

Error in log(x) : non-numeric argument to mathematical function
[1] 10


But that
10
is not appearing in the output. Why is this so?

Answer

You need source("C:/Mahesh/workspaces/r/temp.r", echo = TRUE)