[R] convert matrix

Robert Baer rbaer at atsu.edu
Sun Oct 30 16:20:27 CET 2016

On 10/29/2016 11:19 AM, Elham - via R-help wrote:
> Dear Madam / Sir,I saw this function for "Convert to matrix as it is that you wanted" > test2<-as.matrix(test1)
>> colnames(test2)<-NULL
>> genelist<-c("Fkh2","Swi5","Sic1")
>> rownames(test2)<-genelist
>> test2
>> #      [,1]  [,2]  [,3]
>> #Fkh2 0.141 0.242 0.342
>> #Swi5 0.224 0.342 0.334
>> #Sic1 0.652 0.682 0.182
> what is function for large data?my data and genelist are 28031 rows,how can I convert? clear that I can not write 28031 genes like genelist<-c("Fkh2","Swi5","Sic1")
You can assign the names of your genes by any method convenient. The 
point is not necessarily to use the c() function.   If you have them in 
a .csv file somewhere, simply read them in to create the genelist vector.

If you do not know how to to this you should probably read, "An 
Introduction to R", 

?read.csv typed at the command prompt will give you some specifics

In the end, you will do something like:
genelist  <- read.csv("AfileOfMyGenes.csv", header = TRUE)

# assume your gene names are in the first column which is titled genename
genelist <- genelist$genename

> Your attention would be really appreciated.Best Regards,Elham Dalalbshi Esfahani
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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