paste("foo", 0:5, sep = "")
returns a sequence of numbered strings. Similarly,
sprintf("foo%d", 0:5)
achieves the same result. But suppose I'd like to replace "foo" with a special character (the Greek character lambda, for example), such that the desired output is the same as returned from the call below
c( expression(lambda*0), expression(lambda*1) ) # ... and so on
How could I achieve this? Can I do it by modifying either of first two calls?
Some attempts that don't work:
expression(paste(lambda, 0:5)) # returns a single string, 'lambda'0:5
paste(expression(lambda), 0:5)) # doesn't return the character
sprintf(bquote("expression(lambda)%d"), 0:5) # at this point I've exhausted my sense
This is intended for a plot legend, by the way. Thank you!