[R] Repeating tdt function on thousands of variables
Uwe Ligges
ligges at statistik.uni-dortmund.de
Wed May 3 08:41:30 CEST 2006
Farrel Buchinsky wrote:
> 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 )
Looks like you have to be much more specific:
R> tdt(Genotype.914186, PGWide, famid, pid, fatid, motid, sex, affected)
Error: could not find function "tdt"
Uwe Ligges
> 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.
>
>
More information about the R-help
mailing list