Skip to content

Unexpected parsing behavior of readr (returns 0 rows) #944

@seandavi

Description

@seandavi

This is a report related to seandavi/GEOquery#78. Here, I am comparing the parsing behavior of read.table and read_tsv. In particular, read_tsv returns a tibble <0x0>. Interestingly, if one replaces the GSE14308 with GSE14309, I get the expected behavior.

I have not tried this with a prior readr version yet, but I can if that is helpful.

destfile = 'GSE14308_series_matrix.txt.gz'
f = curl::curl_download("ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE14nnn/GSE14308/matrix/GSE14308_series_matrix.txt.gz",
                        destfile = destfile)

z1 = readr::read_tsv(destfile,
                 skip=65, col_names=TRUE, comment = '!')
#> Parsed with column specification:
#> cols()
dim(z1)
#> [1] 0 0

z2 = read.table(gzfile(destfile),
                     skip=65, header=TRUE, comment = '!')
dim(z2)
#> [1] 45101    13
sessionInfo()
#> R version 3.5.1 (2018-07-02)
#> Platform: x86_64-apple-darwin15.6.0 (64-bit)
#> Running under: macOS Sierra 10.12.6
#> 
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.0      crayon_1.3.4    digest_0.6.18   rprojroot_1.3-2
#>  [5] R6_2.3.0        backports_1.1.2 magrittr_1.5    evaluate_0.12  
#>  [9] pillar_1.3.0    rlang_0.3.0.1   stringi_1.2.4   curl_3.2       
#> [13] rmarkdown_1.10  tools_3.5.1     stringr_1.3.1   readr_1.3.0    
#> [17] hms_0.4.2       yaml_2.2.0      compiler_3.5.1  pkgconfig_2.0.2
#> [21] htmltools_0.3.6 knitr_1.20      tibble_1.4.2

Created on 2018-12-13 by the reprex package (v0.2.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions