Two options spring to mind, using cat()
or writeLines()
> cat(sprintf("Hello World"), "\n")
Hello World
> writeLines(sprintf("Hello World"))
Hello World
The problem you have is that sprintf()
returns a character vector and like any other character vector R prints it like a vector if you print
it. What you want is the string contained with the first element of the character vector (the only one in this case). Hence we use tools to write out the string not print the character vector.
Note that both these can write directly to a file via the file
argument (in cat()
) or the con
argument (in writeLines()
), which you may find useful.