I would like to edit this function so when i open the file i can view properly
library(tibble)
library(vroom)
df <- tibble(x = c("a", "\U00f4"), y = 1:2)
header <- Sys.Date()
fun <- function(x, header = NULL, file){
if (!is.null(header)) vroom_write_lines(as.character(header), file, append = TRUE)
vroom_write(x, file, delim = ",", col_names = TRUE, append = TRUE)
}
### Test the function ####
fun(df, NULL, "test.csv.gz")
fun(df, header, "test.csv.gz")