Open aphalo opened 2 years ago
Two possible approaches: 1) create a wrapper on sprintf()
that understands the short names of the labels and maps the assembled character vector to the label
aesthetic; 2) enhance use_label()
to have an interface similar to R's paste()
.
This does not seem urgent, so I will keep it on hold for some time.
fmt_label()
,
orI could attempt in the future to implement 2), that is accepting both label names and ordinary character
strings. The current implementation seems like an inelegant kludge even if it gets the job done. For the time being, accepting individual character
strings through an ellipsis parameter in addition to a character
vector through parameter labels
is an improvement.
I just implemented function
use_label()
that usespaste()
to assemble the combined label and supports a single value forsep
. This is a simple user interface usable in many cases. A functionfmt_label()
could be also useful when users want to have arbitrary separators or additional text. This is to keep a note that ifuse_label()
turns out to be limiting, a function using a template for the overall format would be a reasonable UI, although not necessarily very easy to implement, in particular handling of parsing errors.