Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Tokyo.R#81 IntRoduction & DemonstRation

kilometer
September 28, 2019

Tokyo.R#81 IntRoduction & DemonstRation

第81回Tokyo.Rでトークした際のスライドです。

kilometer

September 28, 2019
Tweet

More Decks by kilometer

Other Decks in Technology

Transcript

  1. Int
    Roduction
    2019.09.29
    kilometer00
    & DemonstRation
    #81

    View full-size slide

  2. Who!?
    名前: 三村 @kilometer
    職業: ポスドク (こうがくはくし)
    専⾨: ⾏動神経科学(霊⻑類)
    脳イメージング
    医療システム⼯学
    R歴: ~ 10年ぐらい
    流⾏: 季節感

    View full-size slide

  3. 2018.10.20 Tokyo.R #73
    BeginneR Session – Visualization & Plot
    2019.01.19 Tokyo.R #75
    BeginneR Session – Data pipeline
    2019.03.02 Tokyo.R #76
    BeginneR Session – Data pipeline
    2019.04.13 Tokyo.R #77
    BeginneR Session – Data analysis
    2019.05.25 Tokyo.R #78
    BeginneR Session – Data analysis
    2019.06.29 Tokyo.R #79
    BeginneR Session – 確率の基礎
    2019.07.27 Tokyo.R #80
    R Interface to Python

    View full-size slide

  4. Before After
    BeginneR Session
    BeginneR BeginneR

    View full-size slide

  5. BeginneR Advanced Hoxo_m
    If I have seen further it is by standing on
    the shoulders of Giants.
    -- Sir Isaac Newton, 1676

    View full-size slide

  6. #81
    the✨Shiny✨ Speakers
    @kubochi_ukyo
    @flaty13
    @y__mattu
    @igjit
    @okiyuki99
    @kashitan
    @kos59125
    @Np_Ur_ @kyyonko
    @hoxo_m
    @ao T.Ikeda
    2019.09.28

    View full-size slide

  7. R is a free software environment
    for statistical computing and graphics.
    https://www.r-project.org/

    View full-size slide

  8. を、始めたいんだけど。
    私もそろそろ
    ぱそこん
    できるんでしょ?教えてよ。
    ぱそこん
    いいけど、 で何がしたいの?
    ぱそこん って何でもできるんでしょ?
    でも、どうしたらいいか分かんないんだ。
    ⼀昔前

    View full-size slide

  9. を、始めたいんだけど。
    私もそろそろ
    じんこう
    ちのー
    できるんでしょ?教えてよ。
    いいけど、 で何がしたいの?
    って何でもできるんでしょ?
    でも、どうしたらいいか分かんないんだ。
    最近
    じんこう
    ちのー
    じんこう
    ちのー

    View full-size slide

  10. を、始めたいんだけど。
    私もそろそろ
    できるんでしょ?教えてよ。
    いいけど、 で何がしたいの?
    って何でもできるんでしょ?
    でも、どうしたらいいか分かんないんだ。

    View full-size slide

  11. を、始めたいんだけど。
    私もそろそろ
    できるんでしょ?教えてよ。
    いいけど、 で何がしたいの?
    って何でもできるんでしょ?
    でも、どうしたらいいか分かんないんだ。

    View full-size slide

  12. Input
    Output
    Do NOT start from here

    View full-size slide

  13. Input
    Output
    Do NOT start from here
    Whatever

    View full-size slide

  14. Input
    Output
    Do NOT start from here
    Whatever

    1
    2
    3

    View full-size slide

  15. R is a free software environment
    for statistical computing
    and graphics.
    https://www.r-project.org/

    View full-size slide

  16. Integrated Development Environment
    RStudio https://www.rstudio.com/

    View full-size slide

  17. Integrated Development Environment
    RStudio https://www.rstudio.com/

    View full-size slide

  18. Projects
    RStudio

    View full-size slide

  19. File > New Project… > New Directory > New Project
    hogehoge

    View full-size slide

  20. hogehoge
    ~/Documents/R
    hogehoge.Rproj
    .Rproj.user
    Project Root Directory
    Double click!!
    .RData
    .Rhistory
    Auto saved
    project information
    Open project
    New!!

    View full-size slide

  21. ~/Documents/R
    project1
    project2
    project3
    project4

    View full-size slide

  22. スクリプト コンソール

    View full-size slide

  23. 実⾏結果が出る
    ココに書く
    選んで実⾏
    Cmd+Enter
    スクリプト コンソール

    View full-size slide

  24. 代⼊演算⼦ (Assignment Algebra)
    A <- B
    # B to A
    A -> B
    # A to B
    A = B
    # B to A

    View full-size slide

  25. ブール演算⼦ Boolean Algebra
    A == B A != B
    George Boole
    1815 - 1864
    A | B A & B
    A %in% B
    # equal to # not equal to
    # or # and
    # is A in B?
    wikipedia

    View full-size slide

  26. "a" != "b"
    # is A in B?
    ブール演算⼦ Boolean Algebra
    [1] TRUE
    1 %in% 10:100
    # is A in B?
    [1] FALSE

    View full-size slide

  27. 関数 Function
    lift
    ロボヨロ <- function(ロボ, コップ, ⽜乳){
    ロボコップ <- lift(ロボ, コップ)
    出⼒ <- pour(ロボコップ, ⽜乳)
    return(出⼒)
    }
    引数1 引数2 引数3
    関数名
    pour
    ロボ(⼊⼒) ロボコップ 出⼒

    View full-size slide

  28. Input
    Output
    packages
    Data Pipeline

    View full-size slide

  29. Output
    Input
    Input
    Data Pipeline

    View full-size slide

  30. Output
    Input
    Input
    Data Pipeline

    View full-size slide

  31. Output
    Input
    Input
    Data Pipeline

    View full-size slide

  32. Data Pipeline
    readable
    coding

    View full-size slide

  33. Programing
    Write
    Run
    Read
    Think

    View full-size slide

  34. Run!!!
    https://www.amazon.co.jp/dp/B00Y0UI990/

    View full-size slide

  35. Programing
    Write
    Run
    Read
    Think

    View full-size slide

  36. Programing
    Write
    Run
    Read
    Think
    coding style

    View full-size slide

  37. The tidyverse style guide
    https://style.tidyverse.org/
    "Good coding style is like correct punctuation:
    you can manage without it, butitsuremakesthingseasiertoread."
    Google's R Style Guide
    https://style.tidyverse.org/
    "The goal of the R Programming Style Guide is to make our
    R code easier to read, share, and verify."
    R coding style guides

    View full-size slide

  38. The tidyverse style guide
    https://style.tidyverse.org/
    "Good coding style is like correct punctuation:
    you can manage without it, butitsuremakesthingseasiertoread."
    Google's R Style Guide
    https://style.tidyverse.org/
    "The goal of the R Programming Style Guide is to make our
    R code easier to read, share, and verify."
    R coding style guides

    View full-size slide

  39. Programing
    Write
    Run
    Read
    Think
    Write
    Run
    Read
    Think
    Share

    View full-size slide

  40. Text Figure
    Information
    Intention
    Data
    decode
    encode
    feedback
    Programing

    View full-size slide

  41. Shiny is an R package
    that makes it easy to build
    interactive web apps straight from R.
    https://shiny.rstudio.com/

    View full-size slide