[R] Frame Column to List (conversion)
arun
smartpink111 at yahoo.com
Sun Jul 22 09:29:24 CEST 2012
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 <sridiyer at gmail.com>
To: r-help at r-project.org
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.
______________________________________________
R-help at r-project.org 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.
More information about the R-help
mailing list