[ESS] S+ re-factoring ( some recent bugs/annoyances)
Vitalie Spinu
spinuvit at gmail.com
Wed Dec 12 17:22:45 CET 2012
>> gerald.jean at dgag.ca
>> on Wed, 12 Dec 2012 10:28:58 -0500 wrote:
[...]
gj> I am willing to test this release from SVN but have never installed
gj> anything from SVN, where do I find how to do it???
It's very easy. The somewhat obfuscated instructions are
http://ess.r-project.org/Manual/ess.html#Installation
Just do
svn checkout https://svn.r-project.org/ESS/trunk ESS
this creates ESS directory with the source inside. Switch to it and do
make
This step is not strictly necessary but it makes things faster.
Now add to your init file:
(load "~/path/to/ESS/lisp/ess-site")
That's all.
[...]
>> > args("plot")
>> function (x, y, ...)
>> NULL
>> >
Good, now check if this function works:
funnargs <-
function(object){
funname <- as.character(substitute(object))
fun <- tryCatch(object, error=function(e) NULL) ## works for special objects also
if(is.function(fun)) {
args <- args(fun)
fmls <- formals(args)
fmls_names <- names(fmls)
fmls <- gsub('\"', '\\\"', as.character(fmls), fixed=TRUE)
args_alist <- sprintf("'(%s)", paste("(\"", fmls_names, "\" . \"", fmls, "\")", sep = '', collapse = ' '))
envname <- environmentName(environment(fun))
cat(sprintf('(list \"%s\" %s )\n', envname, args_alist))
}
}
it should do something of this kind:
> funnargs(plot)
(list "graphics" '(("x" . "") ("y" . "") ("..." . "")) )
> funnargs(ls)
(list "base" '(("name" . "") ("pos" . "-1") ("envir" . "as.environment(pos)") ("all.names" . "FALSE") ("pattern" . "")) )
If it works, then we are done. You will have your eldoc in the evening.
Let me know what it returns for local functions:
> tt <- list(fun = function(a = 4, b = 5) a*b)
> funnargs(tt$fun)
(list "R_GlobalEnv" '(("a" . "4") ("b" . "5")) )
Vitalie
More information about the ESS-help
mailing list