Frame Column to List (conversion)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Frame Column to List (conversion)

biostat1
Hi,

Input Format: excel file (XLS)
Column 1: Gene ID (alphanumeric)
Column 2 - 10 : (numeric data).

inData = read.xls ( <fileName>)
geneLabel =  inData [  , 1]         - column 1 stored in geneLabel
tempData = inData [ , 2: 10]  
expValues = data.matrix (tempData)   - convert frame into Matrix format

expValues has the matrix format needed for analysis.

I need to bind gene labels as .
 I have this data in geneLablel  (extracted from data.frame)
How do I convert this to a list so i can use
rownames(expValues)  <-  ???????    

thanks


Reply | Threaded
Open this post in threaded view
|

Re: Frame Column to List (conversion)

Rui Barradas
Hello,

Try using the vector geneLabel. You don't need to convert to list.

rownames(expValues) <- geneLabel # if this doesn't work
rownames(expValues) <- as.vector(geneLabel)

But I really don't see a problem with the first. Have you tried it?

Hope this helps,

Rui Barradas

Em 22-07-2012 03:04, biostat1 escreveu:

> Hi,
>
> Input Format: excel file (XLS)
> Column 1: Gene ID (alphanumeric)
> Column 2 - 10 : (numeric data).
>
> inData = read.xls ( <fileName>)
> geneLabel =  inData [  , 1]         - column 1 stored in geneLabel
> tempData = inData [ , 2: 10]
> expValues = data.matrix (tempData)   - convert frame into Matrix format
>
> expValues has the matrix format needed for analysis.
>
> I need to bind gene labels as .
>   I have this data in geneLablel  (extracted from data.frame)
> How do I convert this to a list so i can use
> rownames(expValues)  <-  ???????
>
> thanks
>
>
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Frame-Column-to-List-conversion-tp4637341.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Frame Column to List (conversion)

arun kirshna
In reply to this post by biostat1
Hi,

Try this:

 test1<-read.table(text="
Fkh2 0.141  0.242  0.342
 Swi5 0.224  0.342  0.334
 Sic1 0.652  0.682  0.182
 ",sep="",header=FALSE)
 test1
#    V1    V2    V3    V4
#1 Fkh2 0.141 0.242 0.342
#2 Swi5 0.224 0.342 0.334
#3 Sic1 0.652 0.682 0.182
 geneLabel<-test1[,1]
 expValues<-as.matrix(test1[,2:4])
 colnames(expValues)<-NULL
###############################

 rownames(expValues)<-geneLabel

###############################

 expValues
#      [,1]  [,2]  [,3]
#Fkh2 0.141 0.242 0.342
#Swi5 0.224 0.342 0.334
#Sic1 0.652 0.682 0.182


A.K.



----- Original Message -----
From: biostat1 <[hidden email]>
To: [hidden email]
Cc:
Sent: Saturday, July 21, 2012 10:04 PM
Subject: [R] Frame Column to List (conversion)

Hi,

Input Format: excel file (XLS)
Column 1: Gene ID (alphanumeric)
Column 2 - 10 : (numeric data).

inData = read.xls ( <fileName>)
geneLabel =  inData [  , 1]         - column 1 stored in geneLabel
tempData = inData [ , 2: 10] 
expValues = data.matrix (tempData)   - convert frame into Matrix format

expValues has the matrix format needed for analysis.

I need to bind gene labels as .
I have this data in geneLablel  (extracted from data.frame)
How do I convert this to a list so i can use
rownames(expValues)  <-  ???????   

thanks






--
View this message in context: http://r.789695.n4.nabble.com/Frame-Column-to-List-conversion-tp4637341.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
[hidden email] 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.


______________________________________________
[hidden email] 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.