You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect spec_csv to work on literal data, just like read_csv, but when the data passed to it is just a single line, it tries to interpret the string as a filename:
library(readr) # v2.1.5# `spec_csv` works with a literal two-line string:
spec_csv(file= I("1,x\n2,y"), col_names= c("a", "b"))
#> cols(#> a = col_double(),#> b = col_character()#> )# but doesn't work with a one-line literal string:
spec_csv(file= I("1,x"), col_names= c("a", "b"))
#> Error: '1,x' does not exist in current working directory ('/tmp/RtmptpBMP2/reprex-276b5141a9194f-jolly-bass').# while `read_csv` itself can handle it just fine
spec(read_csv(file= I("1,x"), col_names= c("a", "b")))
#> Rows: 1 Columns: 2#> ── Column specification ────────────────────────────────────────────────────────#> Delimiter: ","#> chr (1): b#> dbl (1): a#> #> ℹ Use `spec()` to retrieve the full column specification for this data.#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.#> cols(#> a = col_double(),#> b = col_character()#> )
I would expect
spec_csv
to work on literal data, just likeread_csv
, but when the data passed to it is just a single line, it tries to interpret the string as a filename:Created on 2024-03-04 with reprex v2.1.0
The text was updated successfully, but these errors were encountered: