Three ways to simply paste characters or URLs by using the paste, paste0 and sprintf functions.
x<-"a" y<-"b" #paste paste(x,y) [1] "a b" #paste0 paste0(x,y) [1] "ab" #paste current working directory to /output/results/ paste0(getwd(),"/output/results") [1] "C:/Users/Kuan/output/results" #sprintf file <-"test.xls" action <-"read and written" user<-"Kuan Hoong" message(sprintf("On %s, the file \"%s\" was %s by %s", Sys.Date(), file, action, user)) On 2016-11-07, the file "test.xls" was read and written by Kuan Hoong
It is easier to use paste0 or paste instead of sprintf as you don’t need to think about the types of arguments being passed.