guess_write_function: Guess write function from file extension

View source: R/pb_write.R

guess_write_functionR Documentation

Guess write function from file extension

Description

This function accepts a filename and tries to return a valid function for writing to it.

Usage

guess_write_function(file)

Arguments

file

filename to parse

Details

guess_write_function understands the following file extensions:

  • rds with saveRDS

  • csv, csv.gz, csv.xz with utils::write.csv

  • tsv, tsv.gz, tsv.xz with a modified utils::write.csv where sep is set to "\t"

  • parquet with arrow::write_parquet

  • txt, txt.gz, txt.xz with writeLines

  • json, json.gz, json.xz with jsonlite::write_json

Value

function for reading the file, if found

See Also

Other pb_rw: guess_read_function(), pb_read(), pb_write()


cboettig/piggyback documentation built on Feb. 29, 2024, 2:35 a.m.