Skip to Content
Rではじめるデータサイエンス
book

Rではじめるデータサイエンス

by Hadley Wickham, Garrett Grolemund, 黒川 利明, 大橋 真也
October 2017
Intermediate to advanced
480 pages
9h 49m
Japanese
O'Reilly Japan, Inc.
Content preview from Rではじめるデータサイエンス
8.4
 ファイルをパースする
125
になっている場合には
parse_xyz()
を使います。
readr
にデータを読み込む方式を伝えるには
col_
xyz()
を使います。
readr
の出力に提供されている情報から型を推測して、
col_types
を常に指定しておくことを強く
推奨します。これにより、一貫した複製可能なデータインポートスクリプトが用意できます。デフォ
ルトの推測に頼っている場合、データが変わっても、
readr
は読み込みを続けてしまいます。厳格で
ありたいなら、
stop_for_problems()
を使います。これは、パースが失敗すると、エラーを投げて
スクリプトを停止します。
8.4.3
 他の戦略
ファイルのパースに役立つ他の一般戦略としては次のようなものがあります。
●
先ほどの例では運が悪かった。デフォルトよりも1行多く調べれば、1 回で正しくパースできた。
challenge2 <- read_csv(
readr_example("challenge.csv"),
guess_max = 1001
)
#> Parsed with column specification:
#> cols(
#> x = col_double(),
#> y = col_date(format = "")
#> )
challenge2
#> # A tibble: 2,000
×
2
#> x y
#> <dbl> <date>
#> 1 404 <NA>
#> 2 4172 <NA>
#> 3 3004 <NA>
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Rではじめるデータサイエンス 第2版

Rではじめるデータサイエンス 第2版

Hadley Wickham, Mine Çetinkaya-Rundel, Garrett Grolemund, 大橋 真也
Rクイックリファレンス 第2版

Rクイックリファレンス 第2版

Joseph Adler, 大橋 真也, 木下 哲也
RStudioではじめるRプログラミング入門

RStudioではじめるRプログラミング入門

Garrett Grolemund, 大橋 真也, 長尾 高弘
仕事ではじめる機械学習 第2版

仕事ではじめる機械学習 第2版

有賀 康顕, 中山 心太, 西林 孝

Publisher Resources

ISBN: 9784873118147Other