Hi, I'm very confused about R structures and the methods to go with them. I'm using R for microarray analysis with Bioconductors. Suppose without reading the documentations, what's the best way to explore a data structure when you know nothing about it? I am currently using is() / class() to see what the object is. str() / attributes() to probe inside the object, and something@something$something to walk it and explore. Is there any other way? Also, without reading documentations, is there a way to know what functions are available to extract data from it? For example, there is sampleNames() which works on ExpressionSet and AnnotatedDataFrame (which is a part of ExpressionSet). How do I know they are available (as sometimes I can't recall where I've seen them and I forgot the function names). And what are R functions? Are those two separate functions or polymorphic functions? I'm also pretty confused about S3, S4, or the regular list. I guess I'm fairly confused about R in general. Any good source of reading (hopefully short and understandable, too) would be appreciated. Thanks. Timothy [[alternative HTML version deleted]]
On 05/27/2010 02:13 AM, Timothy Wu wrote:> Hi, > > I'm very confused about R structures and the methods to go with them. > I'm using R for microarray analysis with Bioconductors. Suppose > without reading the documentations, what's the best way to explore a > data structure when you know nothing about it?probably by reading the documentation, especially vignettes > browseVignettes("Biobase") and then switching to your web browser. If you're asking about Bioconductor functionality in particular, then the Bioconductor mailing list is appropriate http://bioconductor.org/docs/mailList.html> > I am currently using is() / class() to see what the object is. str() > / attributes() to probe inside the object, and > something at something$something to walk it and explore. Is there anyThis looks at the structure, but many classes will want to be manipulated by their API.> other way? . Also, without reading documentations, is there a way to > know what functions are available to extract data from it? For > example, there is sampleNames() which works on ExpressionSet and > AnnotatedDataFrame (which is a part of ExpressionSet). How do I know > they are available (as sometimes I can't recall where I've seen them > and I forgot the function names). And what are R functions? Are > thoseFor an S4 object 'x', I'd class(x) getClass(cls)@package followed by showMethods(classes='ExpressionSet', where=getNamespace('Biobase')) or cls <- c(class(x), getClass(class(x))@contains) pkg <- getClass(cls)@package showMethods(classes=cls, where=getNamespace(pkg)) and conversely showMethods(sampleNames, where=getNamespace(pkg)) Methods for S3 classes can be found in a similar way, but using 'methods'. Both of these only discover classes in packages that are loaded in the currently active session. This will miss plain old functions that don't declare what type of object they intend to operate on. If whan you say 'what are the R functions' you're asking for the function definition, then selectMethod(sampleNames, 'ExpressionSet')> two separate functions or polymorphic functions? I'm also prettysampleNames is a generic. There are methods that operate on eSet (a base class of ExpressionSet), and on AnnotatedDataFrame.> confused about S3, S4, or the regular list. I guess I'm fairly > confused about R in general.For S4 ?Methods ?Classes For S3, maybe section 10.9 of RShowDoc('R-intro') Martin> > Any good source of reading (hopefully short and understandable, too) > would be appreciated. Thanks. > > Timothy > > [[alternative HTML version deleted]] > > ______________________________________________ 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.-- Martin Morgan Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793
The TkListView function in the TeachingDemos package is an interactive tool for looking at the structure and contents of lists and other objects. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of Timothy Wu > Sent: Thursday, May 27, 2010 3:14 AM > To: r-help at r-project.org > Subject: [R] Methods to explore R data structures > > Hi, > > I'm very confused about R structures and the methods to go with them. > I'm > using R for microarray analysis with Bioconductors. Suppose without > reading > the documentations, what's the best way to explore a data structure > when you > know nothing about it? > > I am currently using is() / class() to see what the object is. str() / > attributes() to probe inside the object, and > something at something$something > to walk it and explore. Is there any other way? Also, without reading > documentations, is there a way to know what functions are available to > extract data from it? For example, there is sampleNames() which works > on > ExpressionSet and AnnotatedDataFrame (which is a part of > ExpressionSet). How > do I know they are available (as sometimes I can't recall where I've > seen > them and I forgot the function names). And what are R functions? Are > those > two separate functions or polymorphic functions? I'm also pretty > confused > about S3, S4, or the regular list. I guess I'm fairly confused about R > in > general. > > Any good source of reading (hopefully short and understandable, too) > would > be appreciated. Thanks. > > Timothy > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.
Reasonably Related Threads
- A problem subsetting a data frame
- Error in function (classes, fdef, mtable): unable to find an inherited method for function "indexProbes", for signature "exprSet", "character"
- problem with creation of eSet
- Creating One Single Object with Phenotype and Expression Data
- custom subset method / handling columns selection as logic in '...' parameter