如何使用read_tsv可读的write_tsv保存tibble

时间:2018-04-26 11:14:57

标签: r dataframe io tidyverse readr

我有tibble()data.frame)非常大,我用write_tsv()保存,并想用read_tsv()阅读。我正在使用所有默认选项。 但是,read_tsv()会发出一堆警告(请参阅下面的示例)。我可以使用什么策略来使其工作?

(也尝试了write_csv() - > read_csv()但同样的问题)。 我到目前为止的解决方案是使用read.csv(..., sep="\t"),但read.csv()要慢得多。

> class(PulsarAnnotated2)
[1] "tbl_df"     "tbl"        "data.frame"
> write_tsv(PulsarAnnotated2, path="PulsarAnnotated2.txt")
> PAnnotated <- read_tsv("PulsarAnnotated2.txt")
Parsed with column specification:
cols(
  .default = col_integer(),
  ait_response = col_character(),
  sex = col_logical(),
  rep.delta_npt_score = col_double(),
  rep.rqlq_score_at_inclusion = col_double(),
  rep.rqlq_score_at_evaluation = col_double(),
  aep.delta_csm_score = col_double(),
  DataSet = col_character(),
  sampling_date = col_character(),
  ait_allergen = col_character(),
  R.FileName = col_character(),
  PG.ProteinAccessions = col_character(),
  PG.ProteinGroups = col_character(),
  PG.Quantity = col_double(),
  EG.iRTPredicted = col_double(),
  EG.IsDecoy = col_character(),
  EG.ModifiedSequence = col_character(),
  EG.PrecursorId = col_character(),
  EG.StrippedSequence = col_character(),
  EG.Qvalue = col_double(),
  EG.Svalue = col_double()
  # ... with 7 more columns
)
See spec(...) for full column specifications.
|===============================================================================================================================================| 100%  291 MB
Warning: 1134671 parsing failures.
row # A tibble: 5 x 5 col     row col                 expected               actual file                   expected   <int> <chr>               <chr>                  <chr>  <chr>                  actual 1 16609 sex                 1/0/T/F/TRUE/FALSE     M      'PulsarAnnotated2.txt' file 2 16609 rep.delta_csm_score no trailing characters .52    'PulsarAnnotated2.txt' row 3 16610 sex                 1/0/T/F/TRUE/FALSE     M      'PulsarAnnotated2.txt' col 4 16610 rep.delta_csm_score no trailing characters .52    'PulsarAnnotated2.txt' expected 5 16611 sex                 1/0/T/F/TRUE/FALSE     M      'PulsarAnnotated2.txt'
... ............................ [... truncated]
Warning message:
In rbind(names(probs), probs_f) :
  number of columns of result is not a multiple of vector length (arg 1)

0 个答案:

没有答案