Appending Multiple Dataframes Using Sink

69 views Asked by At

I am trying to put three dataframes (that are filled from a database) in one csv file, so I used sink().

sink('file.csv')
cat('Dataframe 1')
write.csv(df1)
cat('--------------')
cat('\n')
cat('\n')
cat('Dataframe 2')
write.csv(df2)
cat('--------------')
cat('\n')
cat('\n')
cat('Dataframe 3')
write.csv(df3)
cat('----------------')
(sink)

This results with code being displayed at the bottom enter image description here

How can I remove this?

1

There are 1 answers

1
Christoph Wolk On BEST ANSWER

At the end, you have

(sink)

This is a reference to the sink function, and will print the source code of that function. It seems that what you want is to stop diverting output to the sink. Try this instead:

sink()