Hello, I don't know if this is what you want, but your formula is equivalent to
nlstest=nls(Cfl~K*ifelse(Pw > z, 1, exp(-a*Tsoil))*exp(-b*Pw)+c ,start=c(K=5.5, a=0.1, b=0.1, c=2, z=5)) Hope this helps, Rui Barradas -- View this message in context: http://r.789695.n4.nabble.com/nls-and-if-statements-tp4630391p4630398.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.