weixin_39833469
weixin_39833469
2021-01-09 07:38

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

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.

R
> input  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
</chr></chr>

and

R
> 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
</dbl></dbl></chr>

该提问来源于开源项目:rstudio/rstudio

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

5条回答

为你推荐