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

read_table silently drops row when reading FWF file #254

Closed
kevinushey opened this issue Sep 14, 2015 · 1 comment
Closed

read_table silently drops row when reading FWF file #254

kevinushey opened this issue Sep 14, 2015 · 1 comment

Comments

@kevinushey
Copy link

Given a file with the contents:

foo bar baz
1   2   3
4   5   6
7   8   9

readr silently drops the second line:

readr::read_table(file = "foo bar baz\n1   2   3\n4   5   6\n7   8   9\n")
> str(readr::read_table(file = "foo bar baz\n1   2   3\n4   5   6\n7   8   9\n"))
Classestbl_df’, ‘tbland 'data.frame':       2 obs. of  3 variables:
 $ foo: int  1 7
 $ bar: int  2 8
 $ baz: num  3 9
> devtools::session_info()
Session info -------------------------------------------------------------------
 setting  value
 version  R version 3.2.2 Patched (2015-09-09 r69342)
 system   x86_64, darwin13.4.0
 ui       X11
 language (EN)
 collate  en_US.UTF-8
 tz       America/Los_Angeles

Packages -----------------------------------------------------------------------
 package       * version    date       source
 BiocInstaller * 1.18.4     2015-09-03 Bioconductor
 crayon          1.3.1      2015-07-13 CRAN (R 3.2.0)
 curl            0.9.3      2015-08-25 CRAN (R 3.2.1)
 devtools      * 1.8.0      2015-05-09 CRAN (R 3.2.0)
 digest          0.6.8      2014-12-31 CRAN (R 3.2.0)
 git2r           0.11.0     2015-08-12 CRAN (R 3.2.0)
 knitr         * 1.11       2015-08-14 CRAN (R 3.2.1)
 memoise         0.2.1      2014-04-22 CRAN (R 3.2.0)
 Rcpp            0.12.1     2015-09-10 CRAN (R 3.2.2)
 readr         * 0.1.1.9000 2015-09-14 Github (hadley/readr@482c17f)
 rversions       1.0.2      2015-07-13 CRAN (R 3.2.0)
 testthat      * 0.10.0     2015-05-22 CRAN (R 3.2.0)
 xml2            0.1.2      2015-09-01 CRAN (R 3.2.0)
@kevinushey kevinushey changed the title readr::read_table silently drops row when reading FWF file read_table silently drops row when reading FWF file Sep 14, 2015
@hadley
Copy link
Member

hadley commented Sep 21, 2015

I think this is a duplicate of #146 (or at least the same basic problem). Unfortunately you didn't actually provide a fwf, because you're missing the trailing spaces. This works:

read_table("
foo bar baz
1   2   3  
4   5   6  
7   8   9  
", skip = 1)

@hadley hadley closed this as completed in c1bd4bd Sep 21, 2015
@lock lock bot locked and limited conversation to collaborators Sep 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants