Imagine you have a file
sink(\"example.txt\")
data.frame(a = runif(10), b = runif(10), c = runif(10))
sink()
and would want to add some hea
You generally can't expand a file backwards with most filesystems.
Normally, when you save a file, the existing data is completely overwritten. Even if you only change the first two lines of a 1,000,000 line file, the application will usually re-write the unchanged lines to disk when you hit save.
For most file formats, any headers are fixed size, so it's not a problem to change them.
There are also formats that are stream based; since the data is parsed from the stream and used to construct the document, it's possible for the stream to contain an instruction to insert some data at the beginning of the resulting document. These stream-based file formats are fairly complicated, though.