![]() |
文武双全的热带鱼
11 月前 |
我正在尝试使用pheatmap()函数生成一个heatmap。但是,我看到一个错误,在dataframe中存在NA/NaN/Inf。我检查它,但是里面没有NA/NaN/Inf值。这个函数以前起过作用,所以我不知道我做错了什么.有什么建议吗?
heat<-pheatmap(mat, kmeans_k = NA, breaks = NA, border_color= "grey60",cellwidth = 5, cellheight = 0.05, scale = "none", cluster_rows = TRUE,
cluster_cols = TRUE, clustering_distance_rows = "euclidean",
clustering_distance_cols = "euclidean", clustering_method = "complete",
cutree_rows = 1, cutree_cols = 1,
legend_labels = NA, annotation_row = NA, annotation_col = pd,
annotation = pd, annotation_colors = anno_colors, annotation_legend = TRUE,
annotation_names_row = TRUE, annotation_names_col = TRUE,
drop_levels = TRUE, show_rownames = F, show_colnames = T, main = NA, fontsize = 4,
fontsize_row = 4, fontsize_col = 4,
display_numbers = F, number_format = "%.2f", number_color = "grey30",
fontsize_number = 0.8 * fontsize, gaps_row = NULL, gaps_col = NULL,
labels_row = NULL, labels_col = NULL, filename = NA, width = NA,
height = NA, silent = FALSE)
Warning in dist(mat, method = distance) : NAs introduced by coercion
Error in hclust(d, method = method) :
NA/NaN/Inf in foreign function call (arg 10)
发布于 2022-05-17 15:07:47
这些错误和警告的可能原因之一是矩阵
mat
中存在一个非数字向量。
例如,
iris
数据帧中的前四列是数字向量,第五列是字符向量。如果将所有列作为
pheatmap
的输入,则会弹出错误和警告消息:
pheatmap(as.matrix(iris)) # failed.