Entering edit mode
2.9 years ago
adnan.sabar7865
▴
30
Hi everyone
I'm making heatmap by using r studio. My data have 4 rows, 1 with name and 3 with values. I export excel sheet by selecting numeric.
library(readxl)
drug_class <- read_excel("C:/Users/hondalab/OneDrive/Desktop/16s NTR/Hiseq/drug_class.xlsx",
col_types = c("text", "numeric", "numeric",
"numeric"))
When I put heatmap command but I got this error.
heatmap(drug_class)
Error in heatmap(drug_class) : 'x' must be a numeric matrix
print
command showed this;
> print(drug_class)
# A tibble: 29 x 4
`drug class` `NTR 1 Rain` `NTR 2 Dry` `NTR 2 Rain`
<chr> <dbl> <dbl> <dbl>
1 aminocoumarin 0.00233 0.0239 0.00393
2 aminoglycoside 0.00559 0.136 0.0725
3 antibacterial free fatty acids 0 0 0.0000264
4 benzalkonium chloride 0 0.000615 0.000123
5 carbapenem 0.00255 0.0321 0.0184
6 cephalosporin 0.00444 0.0644 0.0485
7 cephamycin 0.00240 0.0264 0.00830
8 diaminopyrimidine 0.00244 0.0324 0.0412
9 fluoroquinolone 0.00637 0.0528 0.0317
10 fosfomycin 0 0 0.000412
# ... with 19 more rows
Can anybody help to solve this error. Thanks!
Your first column is numeric and you need to convert it as row names or you can also skip this.
after converting this, it' still showing same error.
Related SO post: