Issue/Question
I have tab-delimited my-data.txt
file with 51 columns. The col_names
row has no trailing tabs and readr::read_tsv()
correctly detects 51 columns. However, the data columns all contain trailing tabs and readr::read_tsv()
interprets these incorrectly as having 52 columns. While the code runs, I get a warning, which I would like to get rid of. Are there any read_tsv()
arguments that can help handle this? Should I instead use a different readr
function?
my-data.txt
PT AU BA CA GP RI OI BE Z2 TI X1 Y1 Z1 FT PN AE Z3 SO S1 SE BS VL IS SI MA BP EP AR DI D2 SU PD PY AB X4 Y4 Z4 AK CT CY SP CL TC Z8 ZB ZS Z9 SN BN UT PM
J Jacquelin, Sebastien; Straube, Jasmin; Cooper, Leanne; Vu, Therese; Song, Axia; Bywater, Megan; Baxter, Eva; Heidecker, Matthew; Wackrow, Brad; Porter, Amy; Ling, Victoria; Green, Joanne; Austin, Rebecca; Kazakoff, Stephen; Waddell, Nicola; Hesson, Luke B.; Pimanda, John E.; Stegelmann, Frank; Bullinger, Lars; Doehner, Konstanze; Rampal, Raajit K.; Heckl, Dirk; Hill, Geoffrey R.; Lane, Steven W. Jak2V617F and Dnmt3a loss cooperate to induce myelofibrosis through activated enhancer-driven inflammation BLOOD 132 26 2707 2721 10.1182/blood-2018-04-846220 DEC 27 2018 2018 10 WOS:000454429300003
J Renne, Julius; Gutberlet, Marcel; Voskrebenzev, Andreas; Kern, Agilo; Kaireit, Till; Hinrichs, Jan; Zardo, Patrick; Warnecke, Gregor; Krueger, Marcus; Braubach, Peter; Jonigk, Danny; Haverich, Axel; Wacker, Frank; Vogel-Claussen, Jens; Zinne, Norman Multiparametric MRI for organ quality assessment in a porcine Ex-Vivo lung perfusion system PLOS ONE 13 12 e0209103 10.1371/journal.pone.0209103 DEC 27 2018 2018 1 WOS:000454418200015
J Lau, Skadi; Eicke, Dorothee; Oliveira, Marco Carvalho; Wiegmann, Bettina; Schrimpf, Claudia; Haverich, Axel; Blasczyk, Rainer; Wilhelmi, Mathias; Figueiredo, Constanca; Boeer, Ulrike Low Immunogenic Endothelial Cells Maintain Morphological and Functional Properties Required for Vascular Tissue Engineering TISSUE ENGINEERING PART A 24 5-6 432 447 10.1089/ten.tea.2016.0541 MAR 2018 2018 4 WOS:000418327100001
Reprex
Note that I did some manually editing of the reprex because I needed to read in the .txt file to reproduce the issue, but this causes errors in reprex without my computer-specific path). See RStudio Community Topic 8773
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(readr)
my_data <- read_tsv("my-data.txt", quote = "")
#> Parsed with column specification:
#> cols(
#> .default = col_logical(),
#> PT = col_character(),
#> AU = col_character(),
#> TI = col_character(),
#> SO = col_character(),
#> VL = col_double(),
#> IS = col_character(),
#> BP = col_double(),
#> EP = col_double(),
#> AR = col_character(),
#> DI = col_character(),
#> PD = col_character(),
#> PY = col_double(),
#> TC = col_double(),
#> UT = col_character()
#> )
#> See spec(...) for full column specifications.
#> Warning: 3 parsing failures.
#> row col expected actual file
#> 1 -- 51 columns 52 columns 'my-data.txt'
#> 2 -- 51 columns 52 columns 'my-data.txt'
#> 3 -- 51 columns 52 columns 'my-data.txt'
problems(my_data)
#> # A tibble: 3 x 5
#> row col expected actual file
#> <int> <chr> <chr> <chr> <chr>
#> 1 1 <NA> 51 columns 52 columns 'my-data.txt'
#> 2 2 <NA> 51 columns 52 columns 'my-data.txt'
#> 3 3 <NA> 51 columns 52 columns 'my-data.txt'
Created on 2020-04-01 by the reprex package (v0.3.0)
Thank you for taking the time to help me.