I want to trying to wtire a function that will generate heatmaps by calling heatmap.2. Among other things, I want to generate the title of the plots by calling add.expr, for example:
add.expr=c(mtext(text=titlestring, side=3, line=4, cex=1)
With titlestring being a charqacter vector passed to the function by another function:
titlestring<-paste("Mean bin methylation",samplename, "on 5kb flanked CpG Island promoters in mm9")
When I try to run my function I get the following error:
Error in as.graphicsAnnot(text) : object 'titlestring' not found I do know that titlestring is defined in the scope of my funciton , as I tested this using
print()
I thouhgt that the problem my be related to the fact themtext()
expects an exprssion object, so I coerced titlestring to an expression usingas.expression()
. But I still get this error.
Any idea what might be the problem?
Thanks in advance
Dolev Rahat