Class for a DataFrame of Matrices
1
0
Entering edit mode
Tim Yates ▴ 250
@tim-yates-4040
Last seen 9.6 years ago
Hi all! Is there a class that will allow me to have a Table (or DataFrame) of sparse Matrices? data.frame and DataFrame don't work even if I wrap the Matrix like so DataFrame( I( Matrix( nrow=10, ncol=10, sparse=T ) ) ) with the latter So does something exist that I can use? Just thought I'd check before starting out on my own :-) Cheers, Tim ________________________________ This email is confidential and intended solely for the u...{{dropped:12}}
• 927 views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 2.3 years ago
United States
Hi Tim, DataFrame is meant to handle rectangular objects as columns, and it supports the base 'matrix'. It would not be hard to accommodate the Matrix class. Perhaps instead of developing your own class, you could submit a patch adding Matrix support to DataFrame? Thanks, Michael On Tue, Jan 22, 2013 at 2:50 AM, Tim Yates <tyates@picr.man.ac.uk> wrote: > Hi all! > > Is there a class that will allow me to have a Table (or DataFrame) of > sparse Matrices? > > data.frame and DataFrame don't work even if I wrap the Matrix like so > > DataFrame( I( Matrix( nrow=10, ncol=10, sparse=T ) ) ) > > with the latter > > So does something exist that I can use? > > Just thought I'd check before starting out on my own :-) > > Cheers, > > Tim > ________________________________ > > This email is confidential and intended solely for the...{{dropped:13}}
ADD COMMENT
0
Entering edit mode
Good idea! Quick question though, is it possible to handle rectangular objects as cells (rather than columns)? So I end up with: DataFrame with 2 rows and 2 columns a b <matrix> <matrix> 1 M1 M3 2 M2 M4 Where M1-4 are Matrix objects? Cheers, Tim PS: Originally just replied to Michael, so sent again to the list and added a check-mark next to the reasons I hate Outlook on the Mac From: Michael Lawrence <lawrence.michael@gene.com<mailto:lawrence.michael@gene.com>> Date: Tuesday, 22 January 2013 13:06 To: tim <tyates at="" picr.man.ac.uk<mailto:tyates="" at="" picr.man.ac.uk="">> Cc: "bioconductor at r-project.org<mailto:bioconductor at="" r-project.org="">" <bioconductor at="" r-project.org<mailto:bioconductor="" at="" r-project.org="">> Subject: Re: [BioC] Class for a DataFrame of Matrices Hi Tim, DataFrame is meant to handle rectangular objects as columns, and it supports the base 'matrix'. It would not be hard to accommodate the Matrix class. Perhaps instead of developing your own class, you could submit a patch adding Matrix support to DataFrame? Thanks, Michael On Tue, Jan 22, 2013 at 2:50 AM, Tim Yates <tyates at="" picr.man.ac.uk<mailto:tyates="" at="" picr.man.ac.uk="">> wrote: Hi all! Is there a class that will allow me to have a Table (or DataFrame) of sparse Matrices? data.frame and DataFrame don't work even if I wrap the Matrix like so DataFrame( I( Matrix( nrow=10, ncol=10, sparse=T ) ) ) with the latter So does something exist that I can use? Just thought I'd check before starting out on my own :-) Cheers, Tim ________________________________ This email is confidential and intended solely for the u...{{dropped:23}}
ADD REPLY
0
Entering edit mode
Should be possible to store any list using I(), including a list of Matrix objects. It would say <list> at the top, not <matrix> (those labels are always the column type, not cell type). One step further would be to define a MatrixList class, with a SimpleMatrixList implementation, e.g.: setClass("MatrixList", representation("VIRTUAL"), prototype = prototype(elementType = "Matrix"), contains = "List") setClass("SimpleMatrixList", contains = c("MatrixList", "SimpleList")) Or you might want to have a SplitMatrixList, which enforces that every matrix has the same dimensions (like how SplitDataFrameList enforces that all DataFrames have the same number of columns). Using I() would no longer be necessary with these List derivatives. Looking forward to see what you come up with :) Michael On Tue, Jan 22, 2013 at 5:14 AM, Tim Yates <tyates@picr.man.ac.uk> wrote: > Good idea! > > Quick question though, is it possible to handle rectangular objects as > cells (rather than columns)? > > So I end up with: > > DataFrame with 2 rows and 2 columns > a b > <matrix> <matrix> > 1 M1 M3 > 2 M2 M4 > > Where M1-4 are Matrix objects? > > Cheers, > > Tim > > PS: Originally just replied to Michael, so sent again to the list and > added a check-mark next to the reasons I hate Outlook on the Mac > > From: Michael Lawrence <lawrence.michael@gene.com<mailto:> lawrence.michael@gene.com>> > Date: Tuesday, 22 January 2013 13:06 > To: tim <tyates@picr.man.ac.uk<mailto:tyates@picr.man.ac.uk>> > Cc: "bioconductor@r-project.org<mailto:bioconductor@r-project.org>" < > bioconductor@r-project.org<mailto:bioconductor@r-project.org>> > Subject: Re: [BioC] Class for a DataFrame of Matrices > > Hi Tim, > > DataFrame is meant to handle rectangular objects as columns, and it > supports the base 'matrix'. It would not be hard to accommodate the Matrix > class. Perhaps instead of developing your own class, you could submit a > patch adding Matrix support to DataFrame? > > Thanks, > Michael > > > > On Tue, Jan 22, 2013 at 2:50 AM, Tim Yates <tyates@picr.man.ac.uk<mailto:> TYates@picr.man.ac.uk>> wrote: > Hi all! > > Is there a class that will allow me to have a Table (or DataFrame) of > sparse Matrices? > > data.frame and DataFrame don't work even if I wrap the Matrix like so > > DataFrame( I( Matrix( nrow=10, ncol=10, sparse=T ) ) ) > > with the latter > > So does something exist that I can use? > > Just thought I'd check before starting out on my own :-) > > Cheers, > > Tim > ________________________________ > > This email is confidential and intended solely for the...{{dropped:13}}
ADD REPLY

Login before adding your answer.

Traffic: 602 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