Convenience wrapper that detects the file format from the path extension and returns an unevaluated R expression for writing the data. Useful for sibling packages that construct pipelines programmatically (e.g. DM blocks).
Examples
write_file_expr("mtcars", "/tmp/cars.csv")
#> readr::write_csv(x = mtcars, file = "/tmp/cars.csv", quote = "needed",
#> na = "NA")
write_file_expr("iris", "/tmp/flowers.xlsx")
#> writexl::write_xlsx(x = list(iris = iris), path = "/tmp/flowers.xlsx")
write_file_expr("df", "/tmp/data.parquet")
#> arrow::write_parquet(x = df, sink = "/tmp/data.parquet")