Is there a way to continue where source() left off?

I am looking for a function or option that preserves the objects and variables created from the sourced file prior to it finding an error.

You seem to be asking to get the default behaviour ?
If I write a file testme.R
contents:

sourced_vec <- c(1L, 2L, 3L, 4L)
stop("some error")

and I write a script which is

source("testme.R")

The result I observe is an error message reporting "some error" and the environment contains sourced_vec

what am I missing ?

sorry for not making my question more clear. Let's say you have:

sourced_vec <- c(1L, 2L, 3L, 4L)
stop("some error")
vec 2<- c(1L, 2L, 3L, 4L)
vec3v<- c(1L, 2L, 3L, 4L)

and it stops on stop("some error")
how to continue sourcing where error left off? i.e. in vec 2<- c(1L, 2L, 3L, 4L) or in the line that cause the error?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.