Reputation: 2283
I have a dataframe s. I would like to write its content into an outputfile.txt When I use the following commands:
> sink ("outputfile.txt")
> s
> sink()
I get the following message:
[ reached getOption("max.print") -- omitted 5162 rows ]
How can I write all the content of this dataframe directly into a txt file?
Upvotes: 0
Views: 551
Reputation: 545638
Don’t use sink
to write table data to files, use the appropriate functions instead. In base R, that’s write.table
and its sibling functions. Unfortunately the function has some rather questionable defaults — but the following for instance should work:
write.table(data, filename, sep = '\t', quote = FALSE, col.names = NA)
sink
is generally only useful to capture output from functions that don’t return their output but rather echo it directly to the console (such as warnings and messages).
Upvotes: 3