
Statistical Application Development with R and Python

In the previous section, we learned how to import data from external files. Now, there will be many instances where we would be keen to export data from R into suitable foreign
files. The need may arise in automated systems, reporting, and so on, where the other software requires making good use of the R output.
The basic R function that exports data is write.table
, which is not surprising as we saw the utility of the read.table
function. The following screenshot gives a snippet of the write.table
function. While reading, we assign the imported file to an R object, and when exporting, we first specify the R object and then mention the filename. By default, R assigns row names while exporting the object. If there are no row names, R will simply choose a serial number beginning with 1
. If the user does not need such row names, they need to specify row.names = FALSE
in the program:
Exporting data using the write.table function
Example 2.3.1. Exporting...
Change the font size
Change margin width
Change background colour