Skip to content
Prev 320595 / 398506 Next

if clause in data frame

On Mar 29, 2013, at 10:47 AM, arun wrote:

            
That looks likely to be extremely slow. 'rbind.data.frame' is notoriously slow when applied iteratively in loops.

Couldn't this just be:

dat <- expand.grid(m1 = 4:10, n1 = 4:10, x1 = 0: m1, y1 = 0: n1) 
final= within(dat, flag=as.numeric( x1/m1>y1/n1) )