Dear all, many thanks, great work. Here is the feature which Peter suggested (it also includes a string containing the variable name):
DD <- function(f, var.string="x", order=1){ res <- f body.res <- body(f) i <- 1 while(i <= order){ body.res <- D(body.res,var.string) i <- i + 1 } body(res) <- body.res res } f <- function(t,alpha) t^alpha DD(f,"t",2)(2,3) Cheers, marius -- View this message in context: http://r.789695.n4.nabble.com/how-to-get-higher-derivatives-with-deriv-tp2306711p2309761.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.