Is there a function that can be an alternative to paste ? I would like to know if something like this exists in R:
> buildString ( \"Hi {1}, Have a very nice
The sprintf function is one approach as others have mentioned, here is another approach using the gsubfn package:
sprintf
gsubfn
> library(gsubfn) > who <- "Tom" > time <- "day" > fn$paste("Hi $who, have a nice $time") [1] "Hi Tom, have a nice day"