[BioC] matrix row/column displayed as a list

Daniel Brewer daniel.brewer at icr.ac.uk
Tue Apr 10 16:03:50 CEST 2007



Sean Davis wrote:
> On Tuesday 10 April 2007 05:15, Daniel Brewer wrote:
>> Seth Falcon wrote:
>>> Sean Davis <sdavis2 at mail.nih.gov> writes:
>>>> On Tuesday 03 April 2007 06:04, Daniel Brewer wrote:
>>>>> Sean Davis wrote:
>>>>>> On Monday 02 April 2007 12:43, Daniel Brewer wrote:
>>>>>>> Sorry it has taken so long for me to reply, I have been away.  I
>>>>>>> enclose a cut down version of my expression matrix.  Here is an
>>>>>>> example of my
>>>>>>>
>>>>>>> session:
>>>>>>>> matrixExample2
>>>>>>>               GSM89679 GSM89681 GSM89683 GSM89684 GSM89685
>>>>>>> IMAGE:1031489 -0.828   -0.618   -1.154   -0.975   -0.59
>>>>>>> IMAGE:1031497 -0.426   -0.515   -0.765   -0.443   -0.713
>>>>>>> IMAGE:1031509 -0.301   -0.923   1.437    -0.836   0.461
>>>>>>> IMAGE:1031510 -0.976   -0.814   0.268    -1.331   0.913
>>>>>>> IMAGE:1031516 -2.066   0.134    0.332    -2.018   1.489
>>>>>>> IMAGE:1031532 -0.754   -2.202   -1.438   -2.054   -0.836
>>>>>> Hi, Dan.
>>>>>>
>>>>>> What does:
>>>>>>
>>>>>> class(matrixExample2) show?
>>>>>>
>>>>>> What happens if you do:
>>>>>>
>>>>>> matrixExample3 <- as.matrix(matrixExample2)
>>>>>> class(matrixExample3)
>>>>>> matrixExample3[,1]
>>>>>> class(matrixExample3[,1])
>>>>>>
>>>>>> Finally, what is the output of sessionInfo()?
>>>>>>
>>>>>> Sean
>>>>> Hi Sean,
>>>>>
>>>>> Here are the results of the commands you suggested.
>>>>>
>>>>>> load("matrixExample.rdata")
>>>>>> class(matrixExample2)
>>>>> [1] "matrix"
>>>>>
>>>>>> matrixExample3 <- as.matrix(matrixExample2)
>>>>>> class(matrixExample3)
>>>>> [1] "matrix"
>>>>>
>>>>>> matrixExample3[,1]
>>>>> $`IMAGE:1031489`
>>>>> [1] -0.828
>>>>>
>>>>> $`IMAGE:1031497`
>>>>> [1] -0.426
>>>>>
>>>>> $`IMAGE:1031509`
>>>>> [1] -0.301
>>>>>
>>>>> $`IMAGE:1031510`
>>>>> [1] -0.976
>>>>>
>>>>> $`IMAGE:1031516`
>>>>> [1] -2.066
>>>>>
>>>>> $`IMAGE:1031532`
>>>>> [1] -0.754
>>>>>
>>>>>> class(matrixExample3[,1])
>>>>> [1] "list"
>>>>>
>>>>>> sessionInfo()
>>>>> R version 2.4.1 (2006-12-18)
>>>>> x86_64-unknown-linux-gnu
>>>>>
>>>>> locale:
>>>>> LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.
>>>>> UTF-
>>>>> 8;LC_MONETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;
>>>>> LC_NA
>>>>> ME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFI
>>>>> CATIO N=C
>>>>>
>>>>> attached base packages:
>>>>> [1] "stats"     "graphics"  "grDevices" "utils"     "datasets" 
>>>>> "methods" [7] "base"
>>>>>
>>>>> So that does not provide much insight. Have you got any other
>>>>> suggestions?
>>>> Well, you've got me stumped, but that isn't too hard to do.
>>> This is very strange.  Daniel, can you post the matrixExample.rdata
>>> file somewhere I could download it?
>>>
>>> + seth
>> Hi,
>> Here is a URL where you can download the file from:
>> http://www.crukdmf.icr.ac.uk/matrixExample.rdata
>>
>> Also, to give a bit of background.  This matrix is a cut down version of
>> a matrix I constructed from a GSE object using the GEOquery package.
> 
> Dan,
> 
> I see the same thing you see (sessionInfo() below).  I have no idea why this 
> is the way it is (any ideas, Seth?), but to fix the problem, it looks like 
> you can simply do something like:
> 
> newMatrix <- matrix(matrixExample2,ncol=ncol(matrixExample2))
> 
> sessionInfo():
> R version 2.5.0 alpha (2007-03-26 r40902)
> x86_64-unknown-linux-gnu
> 
> locale:
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
> 
> attached base packages:
> [1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"
> [7] "base"
> 
> 
> Sean

Thanks Sean,

Unfortunately though, the matrix command that you provided did not work
for me.  The matrix behaved exactly the same way as previously.  What
did work though was this:
> newMatrix <- cbind(apply(matrixExample2,2,function(x){as.numeric(x)}))
> rownames(newMatrix) <- rownames(matrixExample2)

This might be a bit of a long winded way to do it, but it seemed to work.

Very curious

Thanks

Dan

-- 
**************************************************************
Daniel Brewer, Ph.D.
Institute of Cancer Research
Email: daniel.brewer at icr.ac.uk
**************************************************************

The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addre...{{dropped}}



More information about the Bioconductor mailing list