[R] How to join path with arguments

Andre Nathan andre at digirati.com.br
Tue Feb 19 13:47:37 CET 2008



Hyunchul Kim wrote:
> How to format and join strings ?
> For example, like following short python examples.
>
> *********
> name1 = 'sample-plot'
> filename = '%s.png' % name1

Two options are sprintf() and paste():

> name1 = "sample-plot"
> sprintf("%s.png", name1)
[1] "sample-plot.png"
> paste(name1, "png", sep = ".")
[1] "sample-plot.png"

HTH,
Andre



More information about the R-help mailing list