Description Usage Arguments Details Value Author(s) See Also Examples
In Excel, save data to a csv file. Uuse this function to read that data into an R variable.
1 2 3 4 5 6 7 8 | writeToExcel(data, file = deparse(substitute(data)),
sheet = "Sheet1",
startRow = 1, startCol = 1,
header = TRUE, rowheader = TRUE,
overwrite = TRUE,
pkg = "XLConnect",
...)
|
data |
name of R object to write out |
file |
file to write to; default is the name of the R object |
sheet |
the sheet name or number |
startRow |
the top row in which to begin storing the output |
startCol |
the leftmost column in which to begin storing the output |
header |
do you want to write out the column header(s)/names(s) too? |
rowheader |
do you want to write out the row header(s)/name(s) too? |
overwrite |
If TRUE, file will always be overwritten. If FALSE, file will never be overwritten. If "version", the first version of the filename of the form 'file-xx.csv' that doesn't yet exist will be created, up to a maximum of xx=99. |
pkg |
the name of a supported package, currently "XLConnect", the default, or "WriteXLS". See Details. |
... |
arguments to be passed to other methods |
Essentially a wrapper for R packages XLConnect or WriteXLS.
XLConnect is more versatile: can write new content to an existing file; can write new content to an existing sheet; can write content to a specific area of a sheet. In that sense, XLConnect is useful as "report writer" of output to an Excel file that will eventually be printed, possibly after some manipulation. On the downside, it requires java, which can be difficult to install and support on a machine without the proper authorities. Java constraints also limit the size of the objects that can be written.
WriteXLS does not use java so can write out larger objects. It is more limited in the sense that it completely replaces an existing file, so new sheets cannot be added to a workbook. Also, objects are written beginning in row 1, column 1, so it is not possible to write to a specific region in a sheet. In that sense, WriteXLS is better used to dump large amounts of data to Excel, but arguably writeToCsv is a more capable tool.
overwrite = "version"
is a convenient way to incrementally store results
from different versions of a model.
The name with path of the file written.
dmm
readFromExcel, writeToCsv, copyToExcel
1 2 3 4 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.