KarlSmithByrne
2014-Mar-02 17:26 UTC
[R] Difficulty with what is probably a basic function to retrieve data from a data frame.
I have a large genotype dataset. Each person can take the value Hom or Het (Homozygous or Heterozygous variant), for example. There is also a column variable that tells me if each "Hom" is also damaging or activating, for example. I am trying to write a function that will tell me how many "Hom" and "Het" are also Damaging or Activating, and that are shared across all individuals - without much luck. As I see it, for individuals 1 through 40 I want to extract values "Hom" and "Het" that are also "Damaging" or "Activating", provided this is true for all other individuals. This may be an easy task and I am just not getting it. Thank you for any help you give! -- View this message in context: http://r.789695.n4.nabble.com/Difficulty-with-what-is-probably-a-basic-function-to-retrieve-data-from-a-data-frame-tp4686108.html Sent from the R help mailing list archive at Nabble.com.
Ivan Calandra
2014-Mar-03 09:39 UTC
[R] Difficulty with what is probably a basic function to retrieve data from a data frame.
Hi, First, if you want a precise answer, provide a precise question. That is, provide a reproducible example. A good function for that is dput(), with which you can copy/paste your own data. If your data is too long, create a relevant subset (with head() for example). Regarding your question: are you looking for table()? HTH, Ivan -- Ivan Calandra, ATER Universit? de Franche-Comt? UFR STGI - UMR 6249 Chrono-Environnement 4 Place Tharradin - BP 71427 25211 Montb?liard Cedex, FRANCE ivan.calandra at univ-fcomte.fr http://biogeosciences.u-bourgogne.fr/calandra Le 02/03/14 18:26, KarlSmithByrne a ?crit :> I have a large genotype dataset. Each person can take the value Hom or Het > (Homozygous or Heterozygous variant), for example. > > There is also a column variable that tells me if each "Hom" is also damaging > or activating, for example. > > I am trying to write a function that will tell me how many "Hom" and "Het" > are also Damaging or Activating, and that are shared across all individuals > - without much luck. > > As I see it, for individuals 1 through 40 I want to extract values "Hom" and > "Het" that are also "Damaging" or "Activating", provided this is true for > all other individuals. > > This may be an easy task and I am just not getting it. > > Thank you for any help you give! > > > > -- > View this message in context: http://r.789695.n4.nabble.com/Difficulty-with-what-is-probably-a-basic-function-to-retrieve-data-from-a-data-frame-tp4686108.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >