菩薩でもわかる!rで動かすexcelアドインの作り方
DESCRIPTION
R.NETとExcel-DNAというものを使うとRで動かすExcelアドインが驚くほど簡単に作れるという内容の紹介TRANSCRIPT
![Page 1: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/1.jpg)
菩薩でもわかる! Rで動かすExcelアドインの作り方
第21回R勉強会@東京(#TokyoR)
@teramonagi
![Page 2: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/2.jpg)
皆さん
ご存知のように
![Page 3: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/3.jpg)
LTの時間は10分
![Page 4: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/4.jpg)
全部話すの
![Page 5: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/5.jpg)
![Page 6: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/6.jpg)
なんで
![Page 7: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/7.jpg)
以下、ダイジェストでお送りします
![Page 8: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/8.jpg)
でわ、スタート
![Page 9: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/9.jpg)
0:菩薩とは何か
![Page 10: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/10.jpg)
役職ピラミッド 社長
専務
常務
部長
次長
![Page 11: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/11.jpg)
仏像ランキング 如来
菩薩
明王
天
羅漢
ココ!
![Page 12: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/12.jpg)
1:本日のお題
![Page 13: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/13.jpg)
データマイニングエンジニアになったものの
![Page 14: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/14.jpg)
来る日も来る日もアナリストのサポートばかり
![Page 15: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/15.jpg)
あいつらExcelしか使えやしない
![Page 16: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/16.jpg)
くっそ くっそ!!!!!
![Page 17: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/17.jpg)
そんなことで
![Page 18: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/18.jpg)
お悩みの貴方!
![Page 19: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/19.jpg)
そんな
貴方に送る
![Page 20: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/20.jpg)
Rで動く
Excelアドイン
![Page 21: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/21.jpg)
作り方教えます!
![Page 22: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/22.jpg)
でも、
なんか難しそう…
![Page 23: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/23.jpg)
![Page 24: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/24.jpg)
意外と
簡単に作れる
![Page 25: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/25.jpg)
でわ、スタート
![Page 26: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/26.jpg)
2:使う道具
![Page 27: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/27.jpg)
-R言語
-Excel
-.NET Framework
![Page 28: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/28.jpg)
-R.NET
-Excel-DNA
Produced by
![Page 29: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/29.jpg)
完成図:こんな感じ
![Page 30: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/30.jpg)
俺、似たの知ってるよ?
![Page 31: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/31.jpg)
俺、似たの知ってるよ?
インストール面倒
![Page 32: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/32.jpg)
メリット •メリット
–管理者権限なしでOK
–作成物の配布が楽
–実装とAPIの分離
![Page 33: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/33.jpg)
デメリット •デメリット
–いずれかの.NET系言語書けないと辛い
–データフレームとか渡せない?
![Page 34: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/34.jpg)
3:やってみる
![Page 35: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/35.jpg)
とりあえずDownload
![Page 36: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/36.jpg)
とりあえずDownload
開発者
![Page 37: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/37.jpg)
そして解凍&コピー
![Page 38: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/38.jpg)
1つにまとめて・・・
![Page 39: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/39.jpg)
※ちなみに
これが配布物
![Page 40: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/40.jpg)
.dnaのコードを修正 <DnaLibrary RuntimeVersion="v4.0" Name="My First XLL" Language="CS"> <ExternalLibrary Path="R.NET.dll" /> <Reference Name="R.NET" /> <![CDATA[ using System; using System.Collections.Generic; using System.Linq; using System.Text; using RDotNet; namespace CSLib { public class CSLib { static REngine rengine = null; static CSLib() { // Set the folder in which R.dll locates. REngine.SetDllDirectory(@"C:¥R¥R-2.14.1¥bin¥i386"); rengine = REngine.CreateInstance("RDotNet", new[] { "-q" }); } public static double [] MyRnorm(int number) { return (rengine.EagerEvaluate("rnorm(" + number + ")").AsNumeric().ToArray<double>()); } } } ]]> </DnaLibrary>
![Page 41: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/41.jpg)
xll起動&使ってみる
![Page 42: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/42.jpg)
超簡単!!!!!
![Page 43: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/43.jpg)
詳しくは…
![Page 44: 菩薩でもわかる!Rで動かすExcelアドインの作り方](https://reader031.vdocuments.pub/reader031/viewer/2022020122/54b7aed84a7959d3328b46ef/html5/thumbnails/44.jpg)