Closed NickCH-K closed 4 months ago
@NickCH-K Thank you for reporting this.
I think there is one subtle difference between import()
and import_list()
. For import_list()
, missing files are ignored and the messages are actually warnings. But I agree with you that the messages are confusing.
TODOS
@NickCH-K Thank you very much once again for reporting this. This is the current behavior.
require(rio)
#> Loading required package: rio
not_a_file <- "nope.csv"
import(not_a_file)
#> Error: No such file: nope.csv
import_list(c(not_a_file, "notavailable.csv"))
#> Warning: Import failed for nope.csv
#> Warning: Import failed for notavailable.csv
#> $nope
#> NULL
#>
#> $notavailable
#> NULL
is_a_file <- tempfile(fileext = ".csv")
export(head(iris), is_a_file)
import_list(c(not_a_file, is_a_file))
#> Warning: Import failed for nope.csv
#> $nope
#> NULL
#>
#> $file1700316aa3926
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.2 setosa
#> 2 4.9 3.0 1.4 0.2 setosa
#> 3 4.7 3.2 1.3 0.2 setosa
#> 4 4.6 3.1 1.5 0.2 setosa
#> 5 5.0 3.6 1.4 0.2 setosa
#> 6 5.4 3.9 1.7 0.4 setosa
Created on 2024-03-07 with reprex v2.1.0
When
import_list()
is passed a filename that does not exist, it gives a fairly uninformative error message. Changing this to match theimport()
error message would be ideal.If I run it in Quarto/Rmarkdown it's even more confusing as the "
import failed for nope.csv
" part doesn't show up, it's just the "Calling structure(NULL...
" parts.