Removing [1] with sink and sprintf output in R
I am trying to write a series of characters and numerical values using sprintf and sink: sink("sample.txt", append=TRUE, split=TRUE) sprintf("Hello World") of course, the above is an example, so I don't have the numerical values from a data frame above, but I need to use sprintf. The output in the text file (sample.txt) looks like this: [1] Hello World How do I remove the [1] from the line? Is there a way so the [1] won't write to the file? Two options spring to mind, using cat() or writeLines() > cat(sprintf("Hello World"), "\n") Hello World > writeLines(sprintf("Hello World")) Hello World