Skip to content
Prev 176636 / 398503 Next

R File I/O Capability - Writing output to specific lines of existing file

With only 600 lines, it is relatively easy to read it in and replace
some lines.  For example (untested) is you wanted to replace lines
150:250 with your data, you would do

input <- readLines('filename')
input <- c(input[1:149], newData, input[251:length(input)])
writeLines(input, file='filename')

That does not seem too hard.
On Thu, Apr 9, 2009 at 12:26 AM, Jason Rupert <jasonkrupert at yahoo.com> wrote: