Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
#前処理R ダウンロード
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
ironwest
July 27, 2021
Programming
780
1
Share
#前処理R ダウンロード
ironwest
July 27, 2021
Other Decks in Programming
See All in Programming
検索設計から 推論設計への重心移動と Recall-First Retrieval
po3rin
5
1.4k
Spec-driven Development: How AI Changes Everything (And Nothing)
simas
PRO
0
560
2026-04-15 Spring IO - I Can See Clearly Now
jonatan_ivanov
1
150
UIの境界線をデザインする | React Tokyo #15 メイントーク
sasagar
2
410
PHPでローカル環境用のSSL/TLS証明書を発行することはできるのか? #phpconkagawa
akase244
0
280
クラウドネイティブなエンジニアに向ける Raycastの魅力と実際の活用事例
nealle
2
230
How We Practice Exploratory Testing in Iterative Development( #scrumniigata ) / 反復開発の中で、探索的テストをどう実施しているか
teyamagu
PRO
3
420
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
360
CDK Deployのための ”反響定位”
watany
5
910
実践CRDT
tamadeveloper
0
610
Import assertionsが消えた日~ECMAScriptの仕様はどう決まり、なぜ覆るのか~
bicstone
2
160
Lightning-Fast Method Calls with Ruby 4.1 ZJIT / RubyKaigi 2026
k0kubun
3
2.1k
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Balancing Empowerment & Direction
lara
6
1.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
55k
Odyssey Design
rkendrick25
PRO
2
590
Agile that works and the tools we love
rasmusluckow
331
21k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
190
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
780
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
43k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
290
Writing Fast Ruby
sferik
630
63k
Transcript
Rによるオープンデータ前処 理勉強会(医療データ) NDBオープンデータのファイルを大量ダウンロードする 西田典充
今回お話させていただく内容 →NDBオープンデータアプリの「データ取得」の話です!
NDBオープンデータアプリの作成手順 厚生労働省 NDBオープンデータ HP R URL情報 エクセルファイル Tidyデータ アプリ用データ ダウンロード
データクリーニング データ加工 Shinyアプリケーション
NDBオープンデータアプリの作成手順 厚生労働省 NDBオープンデータ HP R Tidyデータ アプリ用データ データクリーニング データ加工 Shinyアプリケーション
URL情報 エクセルファイル ダウンロード
スクリプトファイルの置き場所 https://github.com/ironwest/ndb_open_data
URL情報 エクセルファイル ダウンロード 52行!
read_html(<URL>)で、「xml_node」というオブジェクトが取得できます。
xml_node のイメージ
xml_nodeのイメージ
<HTML> <body> <div>内容</div> <div>内容</div> <div>内容</div> <div> <div> ・・・ <li>・・・ <a
href="....../00423234.xlsx">初再診料_性年齢別算定回数</a> </div> </div> </body> </HTML>
<a href="....../00423234.xlsx">初再診料_性年齢別算定回数</a> <a href="リンク先のアドレス">表示したいリンクの文字</a>
None
None
None
html_nodes(<xml_node>, "<目的のタグ>")
html_nodes(<xml_node>, "<目的のタグ>") html_text(<対象とするノードセット>) 対象とするノードセット
html_nodes(<xml_node>, "<目的のタグ>") html_attr(<対象とするノードセット> , "href") 対象とするノードセット
None
None
None
None
None
None
a b 1 A 2 B 3 C map2(a,b,func_example) func_example(1,A)
func_example(2,B) func_example(3,C) fe_res suji moji 1 A suji moji 1 B 2 B suji moji 1 C 2 C 3 C
None
None
None
None
None
None
保存したファイル 手作業で直したファイル
URL情報 エクセルファイル ダウンロード 62行!
None
None
None
None
エクセルファイルの保存先ディレクトリのパスを kaiとh3タグから作成 作成したパスが存在するなら何もせず、 存在しないならそのディレクトリを作成する 次にdata変数にあるh4タグの内容を一意な値で取り出す data/ndb/<kai>/<h3>/<h4>という名前のディレクトリが あったら何もしない。なければ作成 dl_to列をdata tibbleに追加。(内容は保存す るエクセルファイルのパス)
ありがとうございました!