Re: [R] Shortest connected path in a matrix

2014-03-05 Thread McCloskey, Bryan
x27;m afraid I'm going to have to write some sort of recursive path-tracing algorithm, but I'm hoping there's a package already in existence that accomplishes this already... -bryan On Tue, Mar 4, 2014 at 1:13 PM, McCloskey, Bryan wrote: > I have a binary rectangular T/F matri

[R] Shortest connected path in a matrix

2014-03-04 Thread McCloskey, Bryan
I have a binary rectangular T/F matrix; I need to be able to calculate the shortest path (i.e., Pythagorean distance) between a populated cell in row j and any populated cell in some row j+n. For instance, if I have a chessboard with random black/white square colors, I need the shortest distance (

Re: [R] Breaking out of multiple loops

2012-12-19 Thread McCloskey, Bryan
head, or if functions are innately faster somehow. Still seems like there should be a way to break out of nested loops, though... -b On Tue, Dec 18, 2012 at 4:50 PM, Duncan Murdoch wrote: > On 12-12-18 1:02 PM, McCloskey, Bryan wrote: >> >> Hey all, >> >> I'm curren

[R] Breaking out of multiple loops

2012-12-18 Thread McCloskey, Bryan
Hey all, I'm currently working through the problems at Project Euler -- this question came up while working on Problem 9 (http://projecteuler.net/problem=9): "A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2. For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2