Recently I've changed into MacOS and encountered some problems in Rstudio using. The thing is, when I plotted my data into heat map using ComplexHeatmap package in R studio, following the commands
mat <- read.table("xxx.csv", header = T, na.string = "-", sep = ";") #read the table from a .csv file rownames(mat) = mat$gene # set the first 'gene' column as row names mat <- data.matrix(mat[-1]) # basically changing into matrix which could be used
after these commands, the problem is that all values in my table are transformed from numeric into integers automatically... I figure that it may lies on the properties of all of my data in the original csv file are somehow inappropriate, but I don't know how should I change it... also with the same commands desired heat map could be build perfectly in windows...
also,I tried another command, replacing 'data.matrix' with 'as.matrix' and it did solve my former problem, but only heat map with discrete pattern, which means each data is represented by one unique colour, could be established. When it comes to plotting my data into a continuous pattern with data shown by continuous colour bar, for which I tended to achieve by following commands:
library(circlize) col_fun = colorRamps2(c(-2,0,2), c("green", "white", "red")) Heatmap(mat, col = col_fun)
then came the error info:
Error in x - break2 : non-numeric argument to binary operator In addition: Warning message: In .bincode(x2, breaks, right = TRUE, include.lowest = TRUE) : NAs introduced by coercion
appreciate any advice, many thanks in advance.