This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error in colorRamp2(c(quantile(mean)[1], quantile(mean)[4], c("white", : argument "colors" is missing, with no default

col_AveExpr <- colorRamp2(c(quantile(mean)[1], quantile(mean)[4], c("white", "black")))

Error in colorRamp2(c(quantile(mean)[1], quantile(mean)[4], c("white", : argument "colors" is missing, with no default

I am trying to make heatmap from sigs.df using complex heatmap, while making color code for average expression i am getting the above error.

The same code worked perfectly fine as;

col_logFC <- colorRamp2(c(min(l2_val),0, max(l2_val)), c("blue", "white", "black"))

I am following the sanbomics tutortial from youtube

please help

scrnaseq complexheatmap

add data using dput(df) command where df is your dataframe

you mean like this;

col_AveExpr <- colorRamp2(c(quantile(dput(mean))[1], quantile(dput(mean))[4], c("white", "black")))

it is still giving me same error it is asking about some argument colors, which i dont seem to find

1 answer

It's because you're not closing your first argument to the function:

col_AveExpr <- colorRamp2(c(quantile(mean)[1], quantile(mean)[4], c("white", "black")))

should be

col_AveExpr <- colorRamp2(c(quantile(mean)[1], quantile(mean)[4]), c("white", "black"))

thank you very much i feel so silly for this

Happens all the time! A habit I've gotten in to lately is putting each argument into a function on it's own line like:

col_AveExpr <- colorRamp2(c(quantile(mean)[1], quantile(mean)[4]), 
                          c("white", "black"))

This helps me catch errors like these a bit more easily.

Log in to answer this question.