[BioC] extracting a column as a vector.

Martin Morgan mtmorgan at fhcrc.org
Thu Nov 8 15:14:06 CET 2012


On 11/08/2012 06:02 AM, James W. MacDonald wrote:
> Hi Priya,
>
> On 11/8/2012 3:25 AM, priya [guest] wrote:
>> I have a matrix in the following way :
>>
>> probes p1 p2 p3 p4 p5
>>
>> 244971 5  6  7  8  9
>> 244972 8  7  9  7  8
>> 244973 4  3  2  6  7
>> 244973 8  5  3  6  8
>>
>>   I would like to extract only the probe names and tried this:
>>   degtl - original matrix( containing 22810 entries)
>>
>>
>> ids<- degtl[,1]
>>
>> and I got
>> head(ids)
>> [1] 244941_at   244959_s_at 244974_at   245009_at   245024_at   245028_at
>> 22810 Levels: 244901_at 244902_at 244903_at 244904_at 244905_at 244906_at
>> 244907_at 244908_at ... AFFX-TrpnX-M_at.
>>
>> I would like to extract the probe names as a vector in  the following form :
>
> Right. Well, this doesn't have anything to do with Bioconductor, and in fact is
> a very rudimentary thing to do in R. So I wouldn't even suggest asking on
> R-help. Although you could try, if you are up for a bit of public shaming.

Actually, the question has been asked, in various forms, here at least three times

https://stat.ethz.ch/pipermail/bioconductor/2012-November/048943.html
https://stat.ethz.ch/pipermail/bioconductor/2012-November/049067.html
https://stat.ethz.ch/pipermail/bioconductor/2012-November/049096.html

R once

https://stat.ethz.ch/pipermail/r-help/2012-November/328389.html

and I believe on StackOverflow!

Martin

>
> Anyway you seem to be lacking very basic knowledge and asking rudimentary
> questions on a listserv is probably the least efficient way to learn things.
> Instead, may I suggest you do some reading? If you ever expect to go far with R
> (or any endeavor you might consider, now that I think about it) you will do well
> to figure out how to help yourself.
>
> If I were you, I would read 'An Introduction to R'
> http://cran.r-project.org/doc/manuals/R-intro.html. This goes over the basic
> data structures in R and shows how to manipulate them.
>
> Best,
>
> Jim
>
>
>>
>> ids<- c("244971","244972","244973",......) for all 22810 levels.Iam unable to
>> do it and always end up with a list.
>>
>>
>>
>>   -- output of sessionInfo():
>>
>> R version 2.15
>> Linux
>>
>> --
>> Sent via the guest posting facility at bioconductor.org.
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives:
>> http://news.gmane.org/gmane.science.biology.informatics.conductor
>


-- 
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



More information about the Bioconductor mailing list