SlideShare une entreprise Scribd logo
1  sur  14
fukuoka.R #15
learnr / tutorialパッケージ
でRの学習コンテンツを作る
2019-08-31
フリーランス 研修・人材育成サービス
タナカケンタ
https://mana.bi/
自己紹介
田中 健太 https://mana.bi/
フリーランスで研修講師や教育コンテンツの開発などに従事
大学院で教育工学を研究➡メーカー系教育子会社
➡調査会社➡フリーランス
Rは社会人になってから使い始めた
Tokyo.Rなどでもチラホラ発表している
たまたま用事があったので…
1. 学習コンテンツに求められること
自学自習ができる
自分が書いたプログラムの答え合わせができる
集合研修の素材として使う場合、環境が統一されていること
(受講者=初学者に環境構築を任せるとうまくいかない)
失敗しても壊れない (何度でもトライアンドエラーができる)
2. learnrパッケージ
https://rstudio.github.io/learnr/index.html
RMarkdownでインタラクティブなチュートリアル
(学習コンテンツ) を作成できる
学習者がコードを記述し、実際にRで実行できる
(チュートリアルが動作しているサーバ上で実行される)
ビデオ (YouTube / Vimeo) も貼り込め、
講義マテリアルとしても、自習コンテンツとしても
利用できる
3. デモ
https://mana.bi/fr1
にデモ用のコンテンツを配置しています
(fukuoka.R当日のみ)
4. learnrパッケージの基本
YAMLに以下のように指定する
output:
learnr::tutorial
runtime: shiny_prerendered
outputは、html_document
およびslidy_presentationなどにも対応している
5. exerciseチャンク
学習者に実行させたいコードは以下のチャンクに記述する
```{r チャンク名, exercise = TRUE} # チャンク名は必須
```
別のチャンクから設定を引き継ぎたい場合は
exercise.setup = "チャンク名" と指定する
6. exerciseチャンクのヒントと解答
チャンク名の後ろに "-hint", "-solution" をつけると、
それぞれコード記述時のヒント、解答として提示できる
```{r chunk01, exercise = TRUE}
```{r chunk01-hint}
```{r chunk01-solution}
本来、"-check" チャンクで
ユーザーの入力内容を評価、
判定できるようだが、どうも
うまくいかない…
7. quizチャンク
チャンクの中で question() 関数を使うと、選択式の
クイズ / テストを実施できる
ただし正解の集計はできない
単一選択式、複数選択式、選択肢のランダム並べ替えなどができる
quiz(question(...), question(...)) としてグループ化できる
8. コンテンツの公開 (publish)
作成したコンテンツを、RStudioから shinyapps.io や
Shiny Serverにpublishできる
Shiny Serverには、"フォルダ/index.Rmd" として配置する
9. tutorialパッケージ
DataCamp社が提供する、インタラクティブなチュートリアルを作
成するためのパッケージ
DataCamp Lightを使い、コードチャンクをDataCamp社の
環境で実行可能な形式に変換する (ネット接続必須)
RコードとPythonコードを共存できる
```{python python.reticulate=FALSE}
すべてのパッケージが利用できる
わけではなく、DataCamp社が
インストール済みのパッケージだけ
利用できる
10. デモ
https://mana.bi/fr2
にデモ用のコンテンツを配置しています
(fukuoka.R当日のみ)
11. tutorialパッケージの基本
すべての ```{r}``` チャンクが変換対象になる
以下のオプションを指定し、グループ化できる
ex="グループ名": 関連するチャンクで同じ名前を指定する
type="pre-exercise-code": 事前のパッケージ読み込みなど
type="sample-code": 実習問題の入力欄
type="hint": ヒントの提示
type="solution": 解答の提示
コードの内容なのか呼び出し回数の制限なのか、うまく変換
されないチャンクも
12. まとめ
Rを学ぶうえで、手元で実行できる環境は重要
しかし、初学者には環境を用意するのが大変
講師も個別の環境をコントロールするのが大変
learnrパッケージやtutorialパッケージを活用すれば、
統一された環境で、すぐにRの学習を始めることができる
どちらも良い点があるが、更新頻度ではleanrが盛ん

Contenu connexe

En vedette

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

fukuoka.R 15 learnr / tutorialパッケージでRの学習コンテンツを作る