your problem is because f is a vector of the same length as runi as a result, the thing you're trying to assign to z[i+1] is also a vector of that length -- View this message in context: http://n4.nabble.com/Newton-method-tp1311057p1311228.html Sent from the R help mailing list archive at Nabble.com.