[BioC] Example of converting graphNEL object to ajacency matrix?

Robert Gentleman rgentlem at fhcrc.org
Thu Apr 24 15:29:04 CEST 2008


Hi,

Zembower, Kevin wrote:
> I'm interested in converting the graphNEL objects in the package SNAData
> into adjacency matrices, so that I can convert them into 'network'
> objects and use the R package 'sna' to analyze them. I'm working through
> the examples in Wasserman and Faust, Social Network Analysis, and these
> datasets will save me considerable typing.

   Why not just analyze them with the tools in RBGL (which are a bit 
more extensive than those in sna)?

> 
> I think that this is possible because of references to the 'coerce'
> method on the graphNEL-class and graphAM-class help pages, but I haven't
> been successful. I've tried commands like:
> coerce(friendship, fs-mat)
> coerce(friendship, fsmat)
> as.matrix(friendship)
> as.graphAM(friendship)
> coerce(from="friendship", to="fsmat")

   I am a bit confused about how you got to any of these incantations. 
The man page for coerce (as) is pretty explicit about needing to specify 
the input, and the name of the desired class, so my first guess would 
have been:

   as(friendship, "matrix")

  which does indeed seem to work.

  Robert

> 
> Can anyone give me an example of converting a graphNEL object to a
> regular matrix, such as an adjacency matrix? I think with just one
> example, I could work things out.
> 
> Thanks for your advice and suggestions.
> 
> -Kevin
> 
> Kevin Zembower
> Internet Services Group manager
> Center for Communication Programs
> Bloomberg School of Public Health
> Johns Hopkins University
> 111 Market Place, Suite 310
> Baltimore, Maryland  21202
> 410-659-6139 
> 
> _______________________________________________
> 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
> 

-- 
Robert Gentleman, PhD
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
PO Box 19024
Seattle, Washington 98109-1024
206-667-7700
rgentlem at fhcrc.org



More information about the Bioconductor mailing list