Error in colorRamp2(c(quantile(mean)[1], quantile(mean)[4], c("white", : argument "colors" is missing, with no default
1
0
Entering edit mode
19 months ago
imran • 0

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 • 1.5k views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
4
Entering edit mode
19 months ago
Trivas ★ 1.8k

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"))
ADD COMMENT
0
Entering edit mode

thank you very much i feel so silly for this

ADD REPLY
2
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

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