Skip to content
Prev 294503 / 398503 Next

Help with writing data to csv

If you have a data.frame and you want a table in Microsoft Word, the
quickest path (without additional packages and assuming you are using
Windows) is

write.table(DataFrameName, file="clipboard", sep="\t", row.names=FALSE)
# If the file is large, you may need "clipboard-128" instead of "clipboard."

Now open Microsoft Excel and select Paste. You now have the data.frame in
Excel. Select the data and copy it. Now open Microsoft Word and select
Paste. You now have the data.frame in Word as a table.

If you need something more flexible, look at packages xlsx, xlsReadWrite,
and R2wd.

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352