Hi, 2 questions: Question 1: example of what I currently do:
for(i in 1:6){sink("temp.txt",append=TRUE) dput(i+0) sink()} x=scan(file="temp.txt") print(prod(x)) file.remove("C:/R-2.5.0/temp.txt") But how to convert the output of the loop to a vector that I can manipulate (by prod or sum etc), without having to write and append to a file? Question 2: > deriv(~gamma(x),"x") expression({ .expr1 <- gamma(x) .value <- .expr1 .grad <- array(0, c(length(.value), 1), list(NULL, c("x"))) .grad[, "x"] <- .expr1 * psigamma(x) attr(.value, "gradient") <- .grad .value }) BUT > deriv3(~gamma(x),"x") Error in deriv3.formula(~gamma(x), "x") : Function 'psigamma' is not in the derivatives table What I want is the expression for the second derivative (which I believe is trigamma(x), or psigamma(x,1)), how can I obtain that? Thanks -- View this message in context: http://www.nabble.com/deriv--loop-tf4166283.html#a11853456 Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@stat.math.ethz.ch 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.