user3495226
user3495226

Reputation: 115

Extract row names

I have a data.frame with 6 columns:

               logFC   AveExpr         t      P.Value   adj.P.Val         B
210390_s_at  -2.502618  8.981372 -6.185754 9.826481e-07 0.004625294 5.5042086
202411_at    -2.454228 10.123040 -5.178844 1.568741e-05 0.010210824 3.0204450
206026_s_at  -2.452167  9.985233 -4.165201 2.574039e-04 0.041392816 0.4953209
228400_at    -2.275939  7.516060 -5.970208 1.769368e-06 0.004841796 4.9794216
204224_s_at  -2.205658  9.816664 -5.376874 9.065351e-06 0.008695580 3.5141782
208747_s_at  -2.035062  8.610333 -5.273978 1.205285e-05 0.009550577 3.2578269
1553151_at    2.034615  9.046217  6.768295 2.045620e-07 0.004625294 6.8959622

I am trying to get the first column starting with (210390_s_at) I have tried:

pids=df[,1] 

and i get this (the second columns)

pids 
 [1] -2.502618 -2.454228 -2.452167 -2.275939 -2.205658 -2.035062  2.034615 

I am a beginner in R, i am sorry if this is obvious

Upvotes: 2

Views: 113

Answers (1)

David Arenburg
David Arenburg

Reputation: 92300

It is not a column what you seeing there, it is the row names. Try

pids <- row.names(df)

Upvotes: 2

Related Questions