Why names() returns empty?
1
0
Entering edit mode
6.7 years ago
zizigolu ★ 4.3k

Hi,

I have this data

> head(datExpr[,1:4])
            CD109  KAT5  WWC2 CD163
Control_D0   1.94 53.18 13.27  0.00
Control_D1   1.99 53.08 12.87  0.00
Control_D10  1.79 50.95 10.76  0.33
Control_D11  1.97 48.13  7.85  0.48
Control_D12  1.94 53.30  9.16  0.56
Control_D13  2.03 52.35  7.15  0.64
> names(datExpr)
NULL

probes = names(datExpr)

gives NULL (empty) values

I can't figure out why names() returns empty. Can one help me please? Thank you

R software error • 3.7k views
ADD COMMENT
1
Entering edit mode

Strange indeed. Did you try with rownames() and colnames()?

ADD REPLY
0
Entering edit mode

Thanks, my genes are in columns that I suppose should go to names

ADD REPLY
1
Entering edit mode

Maybe the names() function is overwritten in the current namespace? Does R allow that? Can you check for it?

ADD REPLY
1
Entering edit mode

R allows that (and here) so that must be the case here.

ADD REPLY
0
Entering edit mode
ADD REPLY
1
Entering edit mode

Good point. Try base::names() then.

ADD REPLY
0
Entering edit mode
> base::names() 
Error in base::names() : 0 arguments passed to 'names' which requires 1
>
ADD REPLY
1
Entering edit mode

base::names(datExpr), not just base::names() :-)

ADD REPLY
0
Entering edit mode

Thank you,

> base::names(datExpr)
NULL
>

Sorry, instead of names (probes = names(datExpr) ) , how can I put my genes from columns in datExpr in prob???

I did so instead: colnames(datExpr)=prob

ADD REPLY
1
Entering edit mode

base::names() gave you NULL as well? My recommendation is wrong then, your names has not been overwritten.

ADD REPLY
0
Entering edit mode

Yes, gave NULL. However thanks for your time

ADD REPLY
0
Entering edit mode

Thanks

> names()
Error in names() : 0 arguments passed to 'names' which requires 1
>
ADD REPLY
2
Entering edit mode
6.7 years ago
jomo018 ▴ 730

Make sure datExpr is a data frame rather than matrix which will respond with NULL. E.g. check: names(data.frame(datExpr))

ADD COMMENT
0
Entering edit mode

names(data.frame(datExpr)) returned my genes thanks

ADD REPLY
0
Entering edit mode

Sorry, in

out <- data.frame(EBDERes$PPMat[names(GeneFC$PostFC),]) 
out$FC <- GeneFC$PostFC

Am I correct that with or without out$FC <- GeneFC$PostFC the out is the same???

I mean, if I want to write out as a table, would the out change if I use out$FC <- GeneFC$PostFC code afterward????

Thank you

ADD REPLY

Login before adding your answer.

Traffic: 2367 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