Others have correctly pointed out that mapply
is made for this purpose, but (for the sake of completeness) a conceptually simpler method is just to use a for
loop.
for (row in 1:nrow(df)) {
df$newvar[row] <- testFunc(df$x[row], df$z[row])
}