write_out: consistently write out data files

Description Usage Arguments Details Value Examples

View source: R/write_out.R

Description

A wrapper around write.csv and saveRDS

Usage

1
2
3
4
5
6
7
write_out(
  object,
  add_date = FALSE,
  output_directory = NULL,
  file_type = "RDS",
  custom_name = NULL
)

Arguments

object

the object to be saved

add_date

should the date be added to the end of the file name?

output_directory

should the output be saved to a particular directory (default to working directory)

file_type

should the file be saved as RDS or csv (default RDS)

custom_name

should a custom name be used instead of the objects' name

Details

This function provides consistent saving. By default the file will be saved with the name of the name of the object.

The format of the date is _(day)_(month)_(year)

Value

none

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
 write_out(mtcars)
 # this will save the mtcars data to an RDS file.

 write_out(mtcars, add_date = TRUE, file_type = "csv", custom_name = "cars")
 # writes the mtcars data to a csv file "cars_(day)_(month)_(year).csv"


## End(Not run)

MarkGoble/mishMashr documentation built on Oct. 12, 2020, 8:24 p.m.