Thanks for the replies! > sapply(1:nrow(A), function(i) f(A[i,],B[i,]) ) > Actually, this solution is even slower than the explicit for-loop :-( Andrey