[R] Repeating tdt function on thousands of variables

From: Farrel Buchinsky <fjbuch_at_gmail.com>
Date: Wed 03 May 2006 - 07:37:06 EST


I am using dgc.genetics to perform TDT analysis on SNP data from a cohort of trios.

I now have a file with about 6008 variables. The first few variables related to the pedigree data such as the pedigree ID the person ID etc. Thereafter each variable is a specific locus or marker. The variables are named by a pattern such as "Genotype.nnnnn" with nnnnn corresponding to a number which is the name or id of the locus.

I am able to get the tdt to run by each locus. >tdt(Genotype.914186, PGWide, famid, pid, fatid, motid, sex, affected )

Clearly I cannot type each locus in one at a time. Instead I want to loop it but am not sure how to do it. I tried lapply but it did not really work.

The example in Dalgaard's book, >sapply( thuesen, mean, na. rm= T) seems to work with basic functions but not with something like tdt. So how does one tell R to calculate the tdt for each variable and output the result to a dataframe in which one of the columns is the locus ID.?

Since I have another table in which every locus ID is in one column and in another column I have its chromosome number and exact position on the chromosome I could always create a vector out of the locusIDs but still I would need to know how to pass it on to the tdt function in R.

-- 
Farrel Buchinsky, MD
Pediatric Otolaryngologist
Allegheny General Hospital
Pittsburgh, PA

______________________________________________
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
Received on Wed May 03 07:43:10 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 03 May 2006 - 18:09:58 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.