190928_TokyoR81_Shiny

417e0d13c3164093c65868c0281fe986?s=47 okiyuki
September 18, 2019

 190928_TokyoR81_Shiny

Tokyo.R #81 応用セッション Shiny Appを支えるエンジニアリング (+おまけ)

417e0d13c3164093c65868c0281fe986?s=128

okiyuki

September 18, 2019
Tweet

Transcript

  1. 4IJOZ"QQΛࢧ͑ΔΤϯδχΞϦϯά 5PLZP3 .PUPZVLJ0,* !PLJZVLJ

  2. ͩΕΑʁ • .PUPZVLJ0,* !PLJZVLJ • %BUB4DJFOUJTU!-*/& • ϐΫςϧ (BNF%FTJHOFS 

  3. 4IJOZͱࢲ IUUQTHJUIVCDPNPLJZVLJ4IJOZ"# 

  4. IUUQHJOHJIBUFOBCMPHDPNFOUSZ 4IJOZͱࢲ 

  5. εϥΠυͷͶΒ͍ • 4IJOZΛσʔλ෼ੳͷμογϡϘʔυʹ࢖༻! • 4IJOZ"QQΛࢧ͑ΔΤϯδχΞϦϯάΛ঺հ • " ۩ମతʹ͸ʁʢࢀߟਤॻ͸͜Εʣ ◦ ෳ਺ਓར༻ˍೝূ

    ◦ ଎౓େࣄ ◦ յΕʹ͍͘ • ʢ͓·͚ʣΤϯδχΞϥΠΫʹ։ൃ͍ͨ͠ 
  6. ຊ೔঺հ͢Δίϯςϯπʢ෼Ͱ࿩ͤΔͱ͜·Ͱʣ • NFNPJTF σʔλಡΈࠐΈߴ଎Խ • QPPM 4IJOZͱ%#ͷίωΫγϣϯ؅ཧ • 4IJOZ1SPYZ %PDLFSʹΑΔ"QQִ཭ͱೝূ

    • 4IJOZMPBEUFTU ෳ਺ਓΞΫηε࣌ͷੑೳܭଌ • 4IJOZUFTU 4IJOZͰͷ୯ମςετ • ʢࢲతʣΑ͘ى͜Δτϥϒϧ • ʢ͓·͚ʣ͓͠ΌΕ6*Λ໨ࢦͯ͠ 
  7. ४උ • ओʹ͜ͷεϥΠυ͸ϙΠϯλʹͳͬͯ·͢ ◦ 2JJUB΁ͷϦϯΫʹৄࡉ͕͋Γ·͢ • ͜ͷεϥΠυͷ4IJOZ4FSWFS͸0QFO 4PVSDF൛ͷ4IJOZ4FSWFSΛࢦ͠·͢ • ͪͳΈʹ

    ◦ 34UVEJP4FSWFS1SP࢖ͬͯΔਓ!ʁ ◦ 4IJOZ4FSWFS1SP࢖ͬͯΔਓ!ʁ 
  8. ຊ೔঺հ͢Δίϯςϯπ • NFNPJTF σʔλಡΈࠐΈߴ଎Խ • QPPM4IJOZͱ%#ͷίωΫγϣϯ؅ཧ • 4IJOZ1SPYZ%PDLFSʹΑΔ"QQִ཭ͱೝূ • 4IJOZMPBEUFTUෳ਺ਓΞΫηε࣌ͷੑೳܭଌ

    • 4IJOZUFTU4IJOZͰͷ୯ମςετ • ʢࢲతʣΑ͘ى͜Δτϥϒϧ • ʢ͓·͚ʣ͓͠ΌΕ6*Λ໨ࢦͯ͠ 
  9. Ͳ͜Ͱ΋Α͘ΈΔμογϡϘʔυͷ࢖͍ํ • ຖ೔όονͰ࠷৽σʔλ͕ੜ੒͞ΕΔ • ࠷৽೔෇ͷσʔλΛ9ਓ͕:ඵ͔͚ͯಡΈࠐΉ • σʔλͷՄࢹԽ ! 9 :

       ͳΒຖ೔ඵ΋σʔλͷಡ ΈࠐΈ͚ͩͰ͕࣌ؒ࢖ΘΕ͍ͯΔ 
  10. NFNPJTFΛͨ·ͨ·ݟ͚ͭΔ  3FG$BTFTUVEZDPOWFSUJOHB4IJOZBQQUPBTZOD IUUQTSTUVEJPHJUIVCJPQSPNJTFTBSUJDMFTDBTFTUVEZIUNM

  11. SMJCNFNPJTFͱ͸ʁ ͸͡Ίͯ͋Δఆٛͨؔ͠਺Λݺͼग़ͨ͠ͱ͖ɺฦ ͞ΕΔσʔλΛΩϟογϡͤ͞Δ ౓໨Ҏ߱ͷݺͼग़͠͸ͦͷΩϟογϡԽ͞Εͨ σʔλΛฦ͢ ! μογϡϘʔυͷσʔλಡΈࠐΈؔ਺Λ NFNPJTFͰΩϟογϡͤ͞Ε͹଎͘ͳΓͦ͏  IUUQTHJUIVCDPNSMJCNFNPJTF

  12. ΍Δ͜ͱ͸͜Ε͚ͩ  ݩͷؔ਺ ϥοϐϯά ճ໨Ҏ߱ͷ ΞΫηε

  13. ৄ͍͠࢖͍ํ͸ҎԼΛͲ͏ͧ!  IUUQTRJJUBDPNPLJZVLJJUFNTCDFECFBFFDG

  14. ຊ೔঺հ͢Δίϯςϯπ • NFNPJTFσʔλಡΈࠐΈߴ଎Խ • QPPM 4IJOZͱ%#ͷίωΫγϣϯ؅ཧ • 4IJOZ1SPYZ%PDLFSʹΑΔ"QQִ཭ͱೝূ • 4IJOZMPBEUFTUෳ਺ਓΞΫηε࣌ͷੑೳܭଌ

    • 4IJOZUFTU4IJOZͰͷ୯ମςετ • ʢࢲతʣΑ͘ى͜Δτϥϒϧ • ʢ͓·͚ʣ͓͠ΌΕ6*Λ໨ࢦͯ͠ 
  15. 4IJOZͱ%#ͷ࿈ܞ !%#ͱͷ઀ଓ؅ཧΛ4IJOZͰ΍ΔͷπϥΠ !%#͔ΒͷಡΈࠐΈ్தͰ4IJOZ"QQ͕ดͯ͡ɺ %#ͱͷίωΫγϣϯ࢒ͬͯ͠·͏ͱ͔ " STUVEJPQPPMΛ࢖ͬͯίωΫγϣϯ؅ཧͷ൥Θ ͠͞ΛճආͰ͖Δ  STUVEJPQPPM0CKFDU1PPMJOHJO3 IUUQTHJUIVCDPNSTUVEJPQPPM

  16.  STUVEJPQPPMΛ࢖͏ͱ͜Μͳײ͡ ˡ QPPMʹ઀ଓ৘ใΛೖΕΔ ˡ 4IJOZ"QQࢭΊͨͱ͖ʹ উखʹQPPMDMPTF ˡ EQMZSͰ42-ॻ͔ͣʹ&5-΋

  17. ຊ೔঺հ͢Δίϯςϯπ • NFNPJTFσʔλಡΈࠐΈߴ଎Խ • QPPM4IJOZͱ%#ͷίωΫγϣϯ؅ཧ • 4IJOZ1SPYZ %PDLFSʹΑΔ"QQִ཭ͱೝূ • 4IJOZMPBEUFTUෳ਺ਓΞΫηε࣌ͷੑೳܭଌ

    • 4IJOZUFTU4IJOZͰͷ୯ମςετ • ʢࢲతʣΑ͘ى͜Δτϥϒϧ • ʢ͓·͚ʣ͓͠ΌΕ6*Λ໨ࢦͯ͠ 
  18. ͦ΋ͦ΋4IJOZ4FSWFSͷπϥΠͱ͜Ζ ! BQQQSPDFTTͰॲཧ͢ΔͨΊɺෳ਺ਓ ͕࢖͏ͱɺઌͷॲཧ͕ऴΘΔ·Ͱ଴ͭඞཁ͕͋Δ 3FG"MUFSOBUJWFBQQSPBDIFTUPTDBMJOH4IJOZXJUI34UVEJP4IJOZ4FSWFS 4IJOZ1SPYZPSDVTUPN BSDIJUFDUVSF IUUQTBQQTJMPODPNBMUFSOBUJWFTUPTDBMJOHTIJOZ 

  19. ͦ΋ͦ΋4IJOZ4FSWFSͷπϥΠͱ͜Ζ ! ೝূػೳ͕ͳ͍ͷͰɺඞཁͳΒ1SPYZʢ/HJOY ͱ͔ʣαʔόͷߏங͕ඞཁ 3FG"EE"VUIFOUJDBUJPOUP4IJOZ4FSWFSXJUI/HJOY IUUQTXXXSCMPHHFSTDPNBEEBVUIFOUJDBUJPOUPTIJOZTFSWFSXJUIOHJOY 

  20. 4IJOZ1SPYZ ! VTFS EPDLFSTIJOZDPOUBJOFSΛىಈͤ͞Δ ! -%"1౳ͷೝূ΋ʢ؀ڥม਺ͰϢʔβ໊΋౉ͤΔʣ 3FG"MUFSOBUJWFBQQSPBDIFTUPTDBMJOH4IJOZXJUI34UVEJP4IJOZ4FSWFS 4IJOZ1SPYZPSDVTUPN BSDIJUFDUVSF IUUQTBQQTJMPODPNBMUFSOBUJWFTUPTDBMJOHTIJOZ

     IUUQTHJUIVCDPNPQFOBOBMZUJDTTIJOZQSPYZ
  21. 4IJOZ1SPYZͷը໘  ˡ ೝূ৘ใΛೖΕΔʢ#BTJDೝূ -%"1FUD ˢ Ϣʔβ͕ΞΫηεͰ͖Δ 4IJOZ"QQ͕ϦετԽ͞Ε ͯݟΕΔ ˢ

    Ϣʔβ໊
  22. 4IJOZ1SPYZ • "QBDIFϥΠηϯε +BWBͷ4QSJOHCPPU • ৄ͍͠ಋೖํ๏͸ҎԼΛͲ͏ͧ! IUUQTRJJUBDPNPLJZVLJJUFNTBBEEF 

  23. ຊ೔঺հ͢Δίϯςϯπ • NFNPJTFσʔλಡΈࠐΈߴ଎Խ • QPPM4IJOZͱ%#ͷίωΫγϣϯ؅ཧ • 4IJOZ1SPYZ%PDLFSʹΑΔ"QQִ཭ͱೝূ • 4IJOZMPBEUFTU ෳ਺ਓΞΫηε࣌ͷੑೳܭଌ

    • 4IJOZUFTU4IJOZͰͷ୯ମςετ • ʢࢲతʣΑ͘ى͜Δτϥϒϧ • ʢ͓·͚ʣ͓͠ΌΕ6*Λ໨ࢦͯ͠ 
  24. 4IJOZ"QQ։ൃதʹ;ͱࢥ͏ ͜ͷ"QQΛ9ਓ͕ಉ࣌ʹݟͨͱ͖ʹɺ࠷ѱͲΕ͘ Β͍ॲཧʹ͔͔࣌ؒΔͩΖ͏͔ʜ! 

  25. STUVEJPDPOG4IJOZJO1SPEVDUJPOΑΓ 3FG4IJOZJO1SPEVDUJPOQ IUUQTTQFBLFSEFDLDPNKDIFOHTIJOZJOQSPEVDUJPO TMJEF ͳΜͩΖ͜Εʁ 

  26. TIJOZMPBEUFTUͱ͸ʁ • 9ਓͷಉ࣌ΞΫηεʹରͯ͠ɺҰ࿈ͷॲཧʹͲͷ ఔ౓͕͔͔࣌ؒΔ͔ΛγϛϡϨʔγϣϯͰ͖Δ • खॱ ◦ 3FDPSE4IJOZ"QQͷૢ࡞Λه࿥͢Δ ◦ 3FQMBZ9XPSLFSىಈͯ͠ɺૢ࡞Λܭଌ

    ◦ "OBMZ[F༷ʑͳՄࢹԽΛఏڙ 
  27. TFTTJPOEVSBUJPO෼ੳ XPLFSUISFBE  ˡ ੺͍ઢ͸3FDPSE࣌ͷૢ࡞׬ྃ ·Ͱͷ࣌ؒ ԣ࣠ ࣌ؒʢӈʹ͍͘΄Ͳ͔͔࣌ؒΔʣ ॎ࣠ 

    ֤γϛϡϨ ʔγϣϯ ͔͔ͬͨ࣌ؒ ॱͰιʔτ͞ ΕͯΔ ͜ͷྫͰ͸ɺ ճͷγϛϡ ϨʔγϣϯΛ ߦ͍ͬͯΔ ֤৭͸ͦΕͧΕͷॲཧʹ ͔͔ͬͯΔ࣌ؒ
  28. TFTTJPOEVSBUJPO෼ੳ XPLFSUISFBE  ճͷγϛϡϨ ʔγϣϯΛߦͬ ͍ͯΔ ! ਓಉ࣌ΞΫηεͩͱɺ ࠷ѱഒ͘Β͍஗͘ͳΔ Մೳੑ͕͋ΔͱಡΉ

    ʢͨͿΜʣ
  29. TIJOZMPBEUFTUͷײ૝ ! γϛϡϨʔγϣϯ݁Ռ͔Βࠞࡶ͢Δͱ9ඵ͘Β͍ ଴ͭՄೳੑ͋Γ·͕͢ɺྃ͝ঝ͍ͩ͘͞ͱݴ͑Δ " ผ్TIJOZDBOOPOΛJOTUBMMͯ͠$-*͔Β࣮ߦ͢ Δඞཁ͕͋Γɺগ͠खؒΛײ͡Δɻ$*Խ͕๬·͍͠ ৄ͍͠࢖͍ํ͸2JJUBΛͲ͏ͧ# IUUQTRJJUBDPNPLJZVLJJUFNTFEFBCB 

  30. ຊ೔঺հ͢Δίϯςϯπ • NFNPJTFσʔλಡΈࠐΈߴ଎Խ • QPPM4IJOZͱ%#ͷίωΫγϣϯ؅ཧ • 4IJOZ1SPYZ%PDLFSʹΑΔ"QQִ཭ͱೝূ • 4IJOZMPBEUFTUෳ਺ਓΞΫηε࣌ͷੑೳܭଌ •

    4IJOZUFTU 4IJOZͰͷ୯ମςετ • ʢࢲతʣΑ͘ى͜Δτϥϒϧ • ʢ͓·͚ʣ͓͠ΌΕ6*Λ໨ࢦͯ͠ 
  31. 4IJOZͰ΋ςετΛճ͍ͯ͜͠͏ ! 4IJOZ4FSWFSʹ"QQΛ%FQMPZ͚ͨ͠ͲΤϥʔ • ͖ͬ͞·Ͱಈ͍͍ͯͨͷʹʜʂ • ։ൃҰൠʹى͜Δ࿩ 

  32. 4IJOZUFTUͱUFTUUIBUΛ࢖͏  4IJOZUFTU • 3QBDLBHF • 1IBOUPN+4ʹΑΔ4IJOZ%SJWFS͕"QQΛىಈ UFTUUIBU • 3ͷίʔυͷ୯ମςετΛߦ͏ͨΊͷ3QBDLBHF

    ! ΤϥʔͰىಈ͠ͳ͍͔΋ʁͱ͍͏৺഑͕ݮΔ
  33. Α͋͘ΔσΟϨΫτϦߏ੒  UFTUεΫϦϓτΛ࣮ߦ͢Δ UFTUεΫϦϓτͱͦͷ݁Ռ

  34. ʢྫʣSVO@UFTUT3 

  35. ʢྫʣUFTU3 

  36. UFTUʹͲΜͳͷΛ༻ҙ͢Δ͔ • ىಈ͔ΒɺϢʔβ͕සൟʹߦ͏΋ͷʢΫϦοΫ͠ ͯσʔλ%-ͱ͔ʣΛUFTU3ʹ·ͣॻ͍͓ͯ͘ • ৄ͍͠࢖͍ํ͸ҎԼΛͲ͏ͧ!  IUUQTRJJUBDPNPLJZVLJJUFNTBCBDBFGG

  37. ຊ೔঺հ͢Δίϯςϯπ • NFNPJTFσʔλಡΈࠐΈߴ଎Խ • QPPM4IJOZͱ%#ͷίωΫγϣϯ؅ཧ • 4IJOZ1SPYZ%PDLFSʹΑΔ"QQִ཭ͱೝূ • 4IJOZMPBEUFTUෳ਺ਓΞΫηε࣌ͷੑೳܭଌ •

    4IJOZUFTU4IJOZͰͷ୯ମςετ • ʢࢲతʣΑ͘ى͜Δτϥϒϧ • ʢ͓·͚ʣ͓͠ΌΕ6*Λ໨ࢦͯ͠ 
  38. ʢࢲతʣ4IJOZ4FSWFSͰΑ͋͘Δ&SSPSͷݪҼ ! ϩʔΧϧͷม਺ɾϥΠϒϥϦΛࢀরͯͨ͠  EFUBDIBMMQBDLBHFTXIJMFXPSLJOHJO3 4UBDL0WFSGMPX IUUQTTUBDLPWFSGMPXDPNRVFTUJPOTEFUBDIBMMQBDLBHFTXIJMFXPSLJOHJOS σλονͷॲ ཧΛೖΕΔ" HMPCBM3

  39. ʢࢲతʣ4IJOZ4FSWFSͰΑ͋͘Δ&SSPSͷݪҼ ! ͋ΔϥΠϒϥϦΛ࢖ͬͯͳ͍ͱࢥͬͯ࡟আͯͨ͠ Β࣮͸࢖͍ͬͯͯؾ͔ͮͳ͔ͬͨ " ໊લۭؒΛࢦఆͨ͠΄͏͕ແ೉  HMPCBM3

  40. ʢࢲతʣ4IJOZ4FSWFSͰΑ͋͘Δ&SSPSͷݪҼ ! 4IJOZ"QQͰ࢖ͬͯΔؔ਺Λมߋ͚ͨ͠Ͳɺ 4IJOZ4FSWFSͰݟͯ΋มΘͬͯͳ͍ʜʁ " SFTUBSUUYU΋ಉ࣌ʹUPVDIίϚϯυͰߋ৽ͯ͠഑ ஔ͢Δͷ͕ແ೉  4IJOZ4FSWFSW$POGJHVSBUJPO3FGFSFODF IUUQTEPDTSTUVEJPDPNTIJOZTFSWFSSFTUBSUJOHBOBQQMJDBUJPO

    ˎSFTUBSUUYUͱ͸ 4IJOZ"QQΛڧ੍తʹSFTUBSUͤ͞ΔͨΊͷۭϑΝΠϧ
  41. ຊ೔ͷ͓͞Β͍ • NFNPJTF σʔλಡΈࠐΈߴ଎Խ • QPPM 4IJOZͱ%#ͷίωΫγϣϯ؅ཧ • 4IJOZ1SPYZ %PDLFSʹΑΔ"QQִ཭ͱೝূ

    • 4IJOZMPBEUFTU ෳ਺ਓΞΫηε࣌ͷੑೳܭଌ • 4IJOZUFTU 4IJOZͰͷ୯ମςετ • ʢࢲతʣΑ͘ى͜Δτϥϒϧ • ʢ͓·͚ʣ͓͠ΌΕ6*Λ໨ࢦͯ͠ 
  42. ·ͱΊ • ΤϯδχΞϦϯάࢹ఺Ͱɺ4IJOZ"QQΛࢧ͑Δศ རػೳΛ঺հͨ͠ • ੈͷதͷ4IJOZ6TFSͷॿ͚ʹͳΕ͹޾͍Ͱ͢ ◦ ͱ͘ʹɺاۀͰ4IJOZΛར༻͍ͯ͠Δ ͍ͨ͠ Ϣʔβʹ޲͚ͯ

    
  43. ʢ͓·͚ʣ͓͠ΌΕ6*Λ໨ࢦͯ͠

  44. ϩʔσΟϯάදࣔ΋͋Δํ͕๬·͍͠ • ! ར༻ऀͷؾ࣋ͪʣͪΌΜͱಈ͍ͯΔʁΤϥʔ Ͱࢭ·ͬͯΔʁΘ͔ΒΜ • ࠷ॳ BOESFXTBMJQMPUMZ#BSTͱ͍͏ͷ͕͋ͬͨ • ࠓ͸͜Ε͕৽͍͠

    BOESFXTBMJTIJOZDTTMPBEFST 
  45. BOESFXTBMJTIJOZDTTMPBEFST • छྨ͔Βબ΂Δ • ͜Ε͚ͩ  3FGʲ3ʳ<TIJOZ>ਤɾςʔϒϧͷग़ྗʹ$444OJQQFUTͰΞχϝʔγϣϯΛ͚ͭΔ  2JJUB IUUQTRJJUBDPNTBTBLJ@,@TBTBLJJUFNTGECFBFFGGD

  46. USFTUMFUFDITIJOZ"DF • "DFΤσΟλΛ 4IJOZ6*Ͱ࢖͏͜ͱ͕Ͱ͖Δ • !ݟͨ໨͕͓͠ΌΕ  3FGUSFTUMFUFDITIJOZ"DF*OUFHSBUJOHUIF"DFFEJUPSXJUI4IJOZ IUUQTHJUIVCDPNUSFTUMFUFDITIJOZ"DF

  47. ESFBN3TTIJOZ8JEHFUT !͓͠ΌΕ6*΢ΟδΣοτ  ESFBN3TTIJOZ8JEHFUTTIJOZ8JEHFUT&YUFOEXJEHFUTBWBJMBCMFJOTIJOZ IUUQTHJUIVCDPNESFBN3TTIJOZ8JEHFUT

  48. ࢀߟ ESFBN3TϑϥϯεͰ3QBDLBHFͷ։ൃ  ESFBN3TcFYQFSU3cFYQFSUTIJOZcEBUBTDJFODFc'SBODF IUUQTXXXESFBNSTGS

  49. ͓͠ΌΕͳ4IJOZ5FNQMBUF͸ଞʹ΋͋Γ·͢ • 3JOUF3GBDFCTEBTI #PPUTUSBQ • FSJDSBZBOEFSTPOTIJOZNBUFSJBM NBUFSJBMEFTJHO • 3JOUF3GBDFGVMM1BHF GVMMQBHFKTͰGVMMQBHFΞϓϦ

    • "QQTJMPOTIJOZTFNBOUJD +BWB4DSJQUৄ͍͠ਓʹظ଴ 
  50. ςϯϓϨʔτσβΠϯΛద༻͓ͯ͠͠ΌΕʹ • STUVEJPTIJOZUIFNFT • OJLEBTICPBSEUIFNFT ྫ͸ҎԼ 

  51. 3FGFSFODF • ֆจࣈ͸5XFNPKJΛ࢖༻͠·ͨ͠ ◦ IUUQTUXFNPKJUXJUUFSDPN