readr icon indicating copy to clipboard operation
readr copied to clipboard

write_*()⁠ family doesn't error when writing list column

Open heliconone opened this issue 10 months ago • 0 comments

The write_*() family of functions currently do not error when the data contains a list column (#938). Trying to write a matrix column however does still give the expected error.

library(tibble)
library(readr) # readr 2.15 & 2.1.5.9000

# List column doesn't error - file is written with an empty column 
tibble(id = 1:3, 
       x = lapply(1:3, seq)) |> 
  write_csv("file1.csv")

# Matrix column errors as expected
tibble(id = 1:3, 
       x = matrix(1:3, 3)) |> 
  write_csv("file1.csv")
#> Error in `cli_block()`:
#> ! `x` must not contain list or matrix columns:
#> ✖ invalid columns at index(s): 2

heliconone avatar Feb 13 '25 05:02 heliconone