You can use range(ab)
and a second paste
(with collapse=':'
) to get this result. For the case where ab
is a single value, I had to use ifelse
.
EDIT: a slightly shorter solution using unique
instead of ifelse
to treat for the case with a single value
ab <- 1:4
plot(ab, main = paste("value", paste(unique(range(ab)), collapse = ':')))
If ab = 1
:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…