Description Usage Arguments Methods (by class) Examples
Writes an R object to a tab-separated values (TSV) file.
1 2 3 4 5 6 7 8 9 10 |
object |
An R object to save as TSV. |
file |
Output file name.
File extensions other than |
... |
Additional arguments to be passed to methods (see below). All additional arguments in methods are ignored. |
row_names |
For R objects with row names.
|
col_names |
Analogous to |
data.table
: Writes a data.table using data.table::fwrite()
.
data.frame
: Writes a data.frame using data.table::fwrite()
.
matrix
: Writes a matrix using data.table::fwrite()
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library(dtutils)
# write a data.table
mtcars_dt <- data.table::as.data.table(mtcars, keep.rownames = TRUE)
write_tsv(mtcars_dt, "mtcars.tsv")
# write a data.frame
write_tsv(mtcars, "mtcars.tsv")
write_tsv(mtcars, "mtcars.tsv", row_names = "ROWNAMES")
# write a matrix
x <- matrix(runif(100), ncol = 5)
write_tsv(x, "matrix.tsv")
colnames(x) <- paste0("col_", letters[1:5])
write_tsv(x, "matrix_with_column_names.tsv")
rownames(x) <- paste0("row_", letters[1:20])
write_tsv(x, "matrix_with_column_and_row_names.tsv")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.