[table output won't reprex cleanly but produces the desired result]

which returns the row numbers that satisfy some logical test. In this case, the test is whether dat[1] (dat$col1 works just as well) is strictly less than the last column. Getting the last column involves just a touch of sleight of hand: dim returns a vector of the number of rows and columns in a matrix-like object. The second number in the vector is the number of columns, in this case 3, so the right hand expression to < collapses to dat[3] and this sets rows to the vector 1,3.