Message-ID: <20071216152520.qo8jnpahvk0k0w4k@icare.u-paris10.fr>
Date: 2007-12-16T14:25:20Z
From: Christophe Genolini
Subject: clean programming
In-Reply-To: <mailman.15.1197802803.31564.r-help@r-project.org>
Hello the list,
I am trying to write a "cleanProgramming" function to test the
procedure I use. For example, I want to be sure that I am not using
globals variables. The function "findGlobals" detect that.
To list the globals used in function "fun", the syntax is :
"findGlobals(fun,FALSE)$variable"
My problem is that I want to use it in a function, something like :
cleanProg <- function(name){
if(length(findGlobals(name,FALSE)$variable>0){
cat("Warnings: there is globals is function ",name,"\a\n")
}
}
But findGlobals take a function as first argument, not a variable
containing a function name.
Anyway to solve that?
Christophe
----------------------------------------------------------------
Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre