Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using 'read_table2()' rather than 'read_table()' for readr Import Dataset #1661

Closed
kevinushey opened this issue Oct 24, 2017 · 5 comments
Assignees
Milestone

Comments

@kevinushey
Copy link
Contributor

kevinushey commented Oct 24, 2017

https://support.rstudio.com/hc/en-us/community/posts/115007434827-No-way-to-import-data-using-RStudio-windows-1-1-364-and-readr-1-1-1?page=1#community_comment_115005232908


Note that, right now, it's not possible to read whitespace-delimited datasets through the readr Import Dataset dialog. Compare e.g.

> input <- "a b c
A 1 2
B 3.0 4.0"

> readr::read_table(input)
Parsed with column specification:
cols(
  a = col_character(),
  `b c` = col_character()
)
# A tibble: 2 x 2
      a `b c`
  <chr> <chr>
1     A   1 2
2     B   3.0

and

> readr::read_table2(input)
Parsed with column specification:
cols(
  a = col_character(),
  b = col_double(),
  c = col_double()
)
# A tibble: 2 x 3
      a     b     c
  <chr> <dbl> <dbl>
1     A     1     2
2     B     3     4
@dfalty
Copy link

dfalty commented Dec 5, 2017

On 1.1.393 (Mac 10.12.2) I don't get read_table2() when trying to use a space for the delimiter.
importdataset

@dfalty dfalty reopened this Dec 5, 2017
@jmcphers
Copy link
Member

jmcphers commented Dec 6, 2017

This has been fixed, but it hasn't been backported to 1.1-patch yet. @dfalty I'll backport it shortly; in the meantime, you can verify the fix in 1.2 if you'd prefer.

jmcphers added a commit that referenced this issue Dec 6, 2017
read_table requires columns to be aligned, but many real-world
whitespace-delimited data files do not have aligned columns.
read_table2, new in readr 1.1.0, does not require columns to be aligned
but otherwise behaves similarly to read_table.
@jmcphers
Copy link
Member

jmcphers commented Dec 6, 2017

Backported to 1.1 in 119d868.

@jmcphers
Copy link
Member

@dfalty this should work in the next patch build (1.1.395 or newer).

@ronblum
Copy link
Contributor

ronblum commented Dec 21, 2017

Confirmed in 1.1.399.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants