From richierocks at gmail.com  Thu Oct 27 09:51:58 2016
From: richierocks at gmail.com (Richard Cotton)
Date: Thu, 27 Oct 2016 10:51:58 +0300
Subject: [Rd] using with inside loop breaks next
Message-ID: <CAPp_+=dh_8cUxK6GxT6oNnK4HvZ1wBqZ+QWggicKiDmuzaGbxQ@mail.gmail.com>

If I want to use with inside a loop, it seems that next gets confused.
To reproduce:

for(lst in list(list(a = 1), list(a = 2), list(a = 3)))
{
  with(lst, if(a == 2) next else print(a))
}

I expect 1 and 3 to be printed, but I see

[1] 1
 Error in eval(expr, envir, enclos) :
  no loop for break/next, jumping to top level

Is this
a) by design, or
b) a bug, or
c) a thing that is rare enough that I should just rewrite my code?

-- 
Regards,
Richie

Learning R
4dpiecharts.com



[Rd] using with inside loop breaks next
Richard Cotton