write.simple: Write Simple

View source: R/ReadWriter.R

write.simpleR Documentation

Write Simple

Description

Writes a matrix-like R object (e.g., a data frame) to a file as tab-separated values (.tsv). The output filename can be auto-generated from the variable's name or manually specified. The file is saved in the specified output directory or the current working directory. The path and variable name can be passed separately and will be concatenated to form the filename.

Usage

write.simple(
  input_df,
  filename = substitute(input_df),
  suffix = NULL,
  extension = "tsv",
  manual_file_name = NULL,
  manual_directory = NULL,
  o = FALSE,
  v = TRUE
)

Arguments

input_df

Data frame to write out. Default: None, must be provided.

filename

The base name for the output file. Default: Name of the input data frame.

suffix

An optional suffix to add to the filename. Default: NULL.

extension

File extension to use. Default: 'tsv'.

manual_file_name

Manually defined filename, overrides automatic naming. Default: NULL.

manual_directory

Directory to save the file in, overrides default directory. Default: NULL.

o

If TRUE, opens the file after writing on OS X using 'system(open ...)'. Default: FALSE.

v

verbose Print path? Default: TRUE.

Value

Outputs a .tsv file and optionally prints the length of the input data frame.

Examples

## Not run: 
if (interactive()) {
  write.simple(input_df = myDataFrame)
}

## End(Not run)

vertesy/ReadWriter documentation built on Nov. 24, 2024, 10:40 p.m.