Searching for data in data.frames
2
0
Entering edit mode
@jdelasherasedacuk-1189
Last seen 8.7 years ago
United Kingdom
This may be a very basic question, but I am looking in the R manual and I haven't found the right function... and I am sure it must exist already. So I apologise in advance if I seem to be blind or missing something! :) What I am after is very simple. I am using Limma and I have a number of data frames (RGList, MAList, MArrayLM...). Sometimes I just want to locate the data for a particular gene, or where a particular value for M occurs, etc. I want to find, for instance, all occurrences of "COL6A3" in RG$genes, and return the position of those occurrences, for instance 345, 7840, 15003. Then I can use that information to give me the foreground intensities corresponding to that gene for any given slide. I came across the function "subset" which seems like it would serve my purpose (or could be adapted to serve my purpose), but I get errors no matter what I do... I appreciate this must be a pretty basic question, but... I have spent the last hour searching for this and so far no luck. I was going to just write a simple search function, but there must be already a function already defined. Thanks! Jose -- Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 Swann Building, Mayfield Road University of Edinburgh Edinburgh EH9 3JR UK
limma limma • 697 views
ADD COMMENT
0
Entering edit mode
@michael-watson-iah-c-378
Last seen 9.7 years ago
Try my.data.frame[grep("search term", my.data.frame$column.name),] -----Original Message----- From: bioconductor-bounces@stat.math.ethz.ch [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of J.delasHeras at ed.ac.uk Sent: 21 April 2006 14:55 To: bioconductor at stat.math.ethz.ch Subject: [BioC] Searching for data in data.frames This may be a very basic question, but I am looking in the R manual and I haven't found the right function... and I am sure it must exist already. So I apologise in advance if I seem to be blind or missing something! :) What I am after is very simple. I am using Limma and I have a number of data frames (RGList, MAList, MArrayLM...). Sometimes I just want to locate the data for a particular gene, or where a particular value for M occurs, etc. I want to find, for instance, all occurrences of "COL6A3" in RG$genes, and return the position of those occurrences, for instance 345, 7840, 15003. Then I can use that information to give me the foreground intensities corresponding to that gene for any given slide. I came across the function "subset" which seems like it would serve my purpose (or could be adapted to serve my purpose), but I get errors no matter what I do... I appreciate this must be a pretty basic question, but... I have spent the last hour searching for this and so far no luck. I was going to just write a simple search function, but there must be already a function already defined. Thanks! Jose -- Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 Swann Building, Mayfield Road University of Edinburgh Edinburgh EH9 3JR UK _______________________________________________ Bioconductor mailing list Bioconductor at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD COMMENT
0
Entering edit mode
Aha! thanks a lot! grep and regexpr were the type of functions I was looking for. Jose Quoting "michael watson (IAH-C)" <michael.watson at="" bbsrc.ac.uk="">: > Try > > my.data.frame[grep("search term", my.data.frame$column.name),] > > -----Original Message----- > From: bioconductor-bounces at stat.math.ethz.ch > [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of > J.delasHeras at ed.ac.uk > Sent: 21 April 2006 14:55 > To: bioconductor at stat.math.ethz.ch > Subject: [BioC] Searching for data in data.frames > > > This may be a very basic question, but I am looking in the R manual and > I haven't found the right function... and I am sure it must exist > already. So I apologise in advance if I seem to be blind or missing > something! :) > > What I am after is very simple. I am using Limma and I have a number of > data frames (RGList, MAList, MArrayLM...). Sometimes I just want to > locate the data for a particular gene, or where a particular value for M > occurs, etc. > > I want to find, for instance, all occurrences of "COL6A3" in RG$genes, > and return the position of those occurrences, for instance 345, 7840, > 15003. Then I can use that information to give me the foreground > intensities corresponding to that gene for any given slide. > > I came across the function "subset" which seems like it would serve my > purpose (or could be adapted to serve my purpose), but I get errors no > matter what I do... > > I appreciate this must be a pretty basic question, but... I have spent > the last hour searching for this and so far no luck. I was going to just > write a simple search function, but there must be already a function > already defined. > > Thanks! > > Jose > > -- > Dr. Jose I. de las Heras Email: > J.delasHeras at ed.ac.uk > The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 > Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 > Swann Building, Mayfield Road > University of Edinburgh > Edinburgh EH9 3JR > UK > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > > -- Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 Swann Building, Mayfield Road University of Edinburgh Edinburgh EH9 3JR UK
ADD REPLY
0
Entering edit mode
@stephen-henderson-71
Last seen 7.0 years ago
Have you tried wh<-which(RG$genes=="COL6A3") Stephen Henderson Wolfson Inst. for Biomedical Research Cruciform Bldg., Gower Street University College London United Kingdom, WC1E 6BT +44 (0)207 679 6827 -----Original Message----- From: bioconductor-bounces@stat.math.ethz.ch [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of J.delasHeras at ed.ac.uk Sent: 21 April 2006 14:55 To: bioconductor at stat.math.ethz.ch Subject: [BioC] Searching for data in data.frames This may be a very basic question, but I am looking in the R manual and I haven't found the right function... and I am sure it must exist already. So I apologise in advance if I seem to be blind or missing something! :) What I am after is very simple. I am using Limma and I have a number of data frames (RGList, MAList, MArrayLM...). Sometimes I just want to locate the data for a particular gene, or where a particular value for M occurs, etc. I want to find, for instance, all occurrences of "COL6A3" in RG$genes, and return the position of those occurrences, for instance 345, 7840, 15003. Then I can use that information to give me the foreground intensities corresponding to that gene for any given slide. I came across the function "subset" which seems like it would serve my purpose (or could be adapted to serve my purpose), but I get errors no matter what I do... I appreciate this must be a pretty basic question, but... I have spent the last hour searching for this and so far no luck. I was going to just write a simple search function, but there must be already a function already defined. Thanks! Jose -- Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 Swann Building, Mayfield Road University of Edinburgh Edinburgh EH9 3JR UK _______________________________________________ Bioconductor mailing list Bioconductor at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor ********************************************************************** This email and any files transmitted with it are confidentia...{{dropped}}
ADD COMMENT
0
Entering edit mode
Quoting Stephen Henderson <s.henderson at="" ucl.ac.uk="">: > Have you tried > > wh<-which(RG$genes=="COL6A3") aha!!! THIS is EXACTLY what I was searching for. while the other functions are also very helpful (grep and regexpr), "which" is *exactly* what I wanted. Perfect! Thank you, Stephen! Jose -- Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374 Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 Swann Building, Mayfield Road University of Edinburgh Edinburgh EH9 3JR UK
ADD REPLY

Login before adding your answer.

Traffic: 504 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6