[R] Repeating tdt function on thousands of variables

Uwe Ligges ligges at statistik.uni-dortmund.de
Wed May 3 13:45:49 CEST 2006


Farrel Buchinsky wrote:

> On 5/3/06, Uwe Ligges <ligges at statistik.uni-dortmund.de> wrote:
> 
>> Looks like you have to be much more specific:
> 
> 
> tdt() is a function within dgc.genetics.
> dgc.genetics is a package written by David Clayton and available at
> http://www-gene.cimr.cam.ac.uk/clayton/software/
> It consists of extensions to the genetics package.
> 
> I could always drop the text from the output of help(tdt) here. Would
> that be acceptable ettiquete?
 >
> On the one hand my question is highly specific but on the other it
> quite general..."How does one pass a whole batch of variable names to
> a function that is not one of R base functions such as "mean")?"

The same way. lapply() and sapply() should work for almost all functions 
given, if nothing strange happens with environemnts, which is the case here:
The problem is tdt() itself. Note that it has its argument data set to 
sys.frame(sys.parent()) as the default, but l/sapply are evaluating in a 
different environment!

So it was really required to tell us where you got the function from.

Uwe Ligges




More information about the R-help mailing list