Hi I want convert, in a function, an argument from a numerical value to a function which returns this value.:
My Code: --8<---------------cut here---------------start------------->8--- dep <- 13 dep <- function() {dep} dep --8<---------------cut here---------------end--------------->8--- This is what I get: #+RESULTS: ,---- | function(PAI) { dep } `---- This is what I want ,---- | function(PAI) { 13 } `---- I thought about using eval(dep), but this gives me the effectively the same. Is it possible to achieve what I want? I somehow have the feeling this is not that easily possible, as the code in the function definition is only evaluated when the function is evaluated. I could obviously do something like --8<---------------cut here---------------start------------->8--- dep <- 13 depVal <- dep dep <- function() {depVal} dep() --8<---------------cut here---------------end--------------->8--- But is there a better solution? Thanks, Rainer -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug PGP: 0x0F52F982
signature.asc
Description: PGP signature
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.