Heatmap error: 'x' must be a numeric matrix
0
0
Entering edit mode
2.2 years ago

hi;

It's repeated but I'm trying to make heatmap from matrix data but i'm receiving this error every time, Error: "x" must be a numeric matrix.

1st row and colum with names as shown below, Please guide. Thanks

kisshion.influent
Toba.influent
kisshion.effluent
Toba.effluent
NTR.1.Dry
NTR.2.Dry
NTR.3.Dry
NTR.4.Dry
NTR.1.Rain.Start
NTR.1.Rain.High.Flow
NTR.2.Rain
NTR.3.Rain
NTR.4.Rain
p__Bacteroidetes;c__Bacteroidia
0.15807803
0.089749759
0
0.002657773
0.00168062
0.000954514
0.011313115
0.001059835
0.000557278
0.333735829
0.164297121
0.234835771
0.122873472
p__Bacteroidetes;c__Cytophagia
0
0.00240616
0.01053446
0.010370525
0.073324826
0.006608172
0.046760876
0.009054021
0.061509526
0.000201248
0
0
0
p__Bacteroidetes;c__Flavobacteriia
0.073840408
0.206147738
0.38626354
Heatmap • 828 views
ADD COMMENT
0
Entering edit mode

Check str(your_matrix)

ADD REPLY
0
Entering edit mode

chr [1:17, 1:13] "0.15807803" "0" "0.073840408" "0.001968405" "0.000403775" ...

attr(*, "dimnames")=List of 2 ..$ : chr [1:17] "p__Bacteroidetes;c__Bacteroidia" "p__Bacteroidetes;c__Cytophagia" "p__Bacteroidetes;c__Flavobacteriia" "p__Bacteroidetes;c__Sphingobacteriia" ... ..$ : chr [1:13] "kisshion.influent" "Toba.influent" "kisshion.effluent" "Toba.effluent" ... Thats answer

ADD REPLY
0
Entering edit mode

Then you have your answer, all the content is of class "character" you must convert your data to matrix/numeric

ADD REPLY
0
Entering edit mode

I didn't understand how i can convert

ADD REPLY
0
Entering edit mode
as.matrix(df)

or

  apply(df, 2 ,as.numeric)

etc... depending on your data

ADD REPLY
0
Entering edit mode

chr [1:17, 1:13] "0.15807803" "0" "0.073840408" "0.001968405" "0.000403775" ...

  • attr(*, "dimnames")=List of 2 ..$ : chr [1:17] "p__Bacteroidetes;c__Bacteroidia" "p__Bacteroidetes;c__Cytophagia" "p__Bacteroidetes;c__Flavobacteriia" "p__Bacteroidetes;c__Sphingobacteriia" ... ..$ : chr [1:13] "kisshion.influent" "Toba.influent" "kisshion.effluent" "Toba.effluent" ...

Thats answer

ADD REPLY

Login before adding your answer.

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