Reputation: 221
When having a paste()
with a given delimiter like in the below example, is it possible to suppress the delimiter at single positions?
The example is part of a ggplot()+labs(subtitle=paste(...))
with whitespace separator:
paste("Minimum/maximum number of observations per point:", min(currdataset_S03$nobs), "* /", max(currdataset_S03$nobs), sep = " ")
Now, I'd like to suppress/skip only the whitespace between 7 (=currdataset_S03$nobs) and the asterisk (see red arrow in the image). But don't know how.
I'm quite sure that I have seen a quite simple solution some time ago. But I can't remember it, - or my memory may not serves me right.
However, I could not find any helpful post so far. So, has anybody an idea for me please?
Upvotes: 0
Views: 35
Reputation: 72974
You could solve this using sprintf
.
sprintf("Minimum/maximum number of observations per point: %s * / %s",
min(currdataset_S03$nobs), max(currdataset_S03$nobs))
# [1] "Minimum/maximum number of observations per point: 7 * / 14"
Data:
currdataset_S03 <- data.frame(nobs=7:14)
Upvotes: 1