Export | R Documentation |
Uses the export
function in the rio package to export a file to disk. This function adds an argument for converting row.names to a column in the resulting file.
Export(x, file, format, ..., keep.row.names)
x |
A data frame or matrix to be written to a file. |
file |
A character string naming a file. If the file name has an extension, such as |
format |
see |
... |
Additional arguments; see |
keep.row.names |
If set to |
This is a convenience function in the car package for exporting (writing) a data frame to a file in a wide variety of formats including csv, Microsoft Excel. It optionally allows converting the row.names for the data frame to a column before writing. It then calls export
in the rio
package. That function in turn uses many other packages and functions for writing the function to a file.
The name of the output file as a character string (invisibly).
Sanford Weisberg sandy@umn.edu
Chung-hong Chan, Geoffrey CH Chan, Thomas J. Leeper, and Jason Becker (2017). rio: A Swiss-army knife for data file I/O. R package version 0.5.0.
export
, Import
if(require("rio")) {
Export(Duncan, "Duncan.csv", keep.row.names="occupation")
Duncan2 <- Import("Duncan.csv") # Automatically restores row.names
identical(Duncan, Duncan2)
# cleanup
unlink("Duncan.csv")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.