## Create a template file in the tempdir...
tpl <- tempfile("template", fileext = ".txt")
cat("Example template file\nto be used with fileEdit()\n", file = tpl)
## ... and edit a new file, starting from that template:
newf <- tempfile("test", fileext = ".txt")
fileEdit(newf, template = tpl, wait = TRUE)
## Make sure the content ends with \n, and read it
cat("\n", file = newf, append = TRUE)
cat("Your file contains:\n")
readLines(newf)
## Eliminate both the file and template
unlink(newf)
unlink(tpl)
Run the code above in your browser using DataLab