Append lines to a file
I'm new using R. I'm trying to add (append) new lines to a file with my existing data in R. The problem is that my data has about 30000 rows and 13000 cols. I already try to add a line with the writeLines
function but the resulting file contains only the line added.
Have you tried using the write
function?
line="blah text blah blah etc etc"
write(line,file="myfile.txt",append=TRUE)
write.table
, write.csv
and others all have the append=
argument, which appends append=TRUE
and usually overwrites if append=FALSE
. So which one you want to / have to use, depends on your data.
By the way, cat()
can also be used to write text to a file and also has the append=
argument.