Update corrplot.R: option to remove leading 0s added#274
Update corrplot.R: option to remove leading 0s added#274erinnacland wants to merge 2 commits intotaiyun:masterfrom
Conversation
I added an option to remove the leading zeros for the correlation values in 'method = "number"' and 'addCoef.col'. It is by default turned off.
|
(this option has also been requested in issues): |
There was a problem hiding this comment.
This PR has a few issues:
-
It does not load. There is a duplicated
ifstatement that causes an error (lines 890-891 should be deleted) -
del.lead.zero=TRUEoverridesnumber.digitssetting (i.e., it forces number.digits=2)
I suggest replacing line 328 with:
del.lead.zero = function(val) {sub("^(-?)0.", "\1.", val) }}
and reverse the order of the format/del.lead.zero functions when called later so it executes on the format()ed string:
change line 713 to:
labels = del.lead.zero(format(round(x, number.digits), nsmall = number.digits)),
change line 896 to (and fix the parens so nsmall=number.digits is passed to format()):
labels = del.lead.zero(format(
Not sure how (or if possible) to edit a PR, but if @taiyun would like I can submit a new PR with the changes, add an example to the vignette, add to ?corrplot, and add a MRE to #274
I added an option to remove the leading zeros for the correlation values in 'method = "number"' and 'addCoef.col'. It is by default turned off.