Hide column label of genes
1
1
Entering edit mode
6 weeks ago
synat.keam ▴ 30

Dear All,

It might be a naive question, but I got stuck a bit. How could I read csv file into R and make the gene column had no label like the picture in attached. everytime I read my data in, the label is still there.

thank in advance.

regards,

synat

enter image description here

geneexpression • 330 views
ADD COMMENT
0
Entering edit mode

colnames(mat) = NULL

ADD REPLY
0
Entering edit mode

Dear galaxy,

thank for your response.

i have dataframe called ifn

colnames(ifn) = NULL all the columns are gone

I just need to hide one column in my dataframe, which are genes I used the following code

colnames(ifn$genes)= NULL, gene column is still there

Attached image is my dataframe

enter image description here .

Kind Regards,

Synat

ADD REPLY
3
Entering edit mode
6 weeks ago

I'm going to interpret your question a bit. I'm assuming here that you just want to convert your data.frame to a matrix.

# create a matrix from the data.frame
mat2 = as.matrix(mat[,-1]) 

# add rownames to the matrix
rownames(mat2) = mat[,1] 

# show the matrix with genes as rownames
mat2

Note that if the "genes" column has duplicates, this won't work as expected since rownames must be unique.

ADD COMMENT
1
Entering edit mode

Dear Sean,

it works perfectly. big thank for your kind help and thank to galaxy too.

Kind Regards,

synat

ADD REPLY

Login before adding your answer.

Traffic: 1612 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6