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

R&RStudio入門

hujuu
November 19, 2016

 R&RStudio入門

<Rのインストールから簡単な操作を実践>

~ Rの概要と使い方を学びます ~

・RとR studioの紹介と使い方
・ベーシックなスクリプトを書いてみる
・CSVを読み込んで分析の準備をしよう

hujuu

November 19, 2016
Tweet

More Decks by hujuu

Other Decks in Education

Transcript

  1. R Business Analysis ͻͱ·ͣࣗݾ঺հ • ήʔϜ։ൃͯ͠·͢ • ࠷ۙ͸ओʹQA • R

    ྺ • 1೥൒ • ؁ౘ • ͋Θͤͯɺߚ஡΋ • స৬૬ஊड෇த!! @hujuu
  2. R Business Analysis ࣮຿ʹ׆͖ΔܗͰRΛֶͿ • ೔ৗۀ຿Ͱσʔλ෼ੳΛ͍ͯ͠Δ͕ɺֶͼ͋͏؀ڥ ͕ͳ͘ࠔ͍ͬͯΔ • σʔλ෼ੳπʔϧͱͯ͠,ʮ R

    ʯΛݕ౼͍ͯ͠Δ • ઐ໳ੑ΍ϓϩάϥϛϯάεΩϧʹدͬͨษڧձͰ͸ ͳ࣮͘຿ʹ௚݁͢Δσʔλ෼ੳྗΛߴΊ͍ͨ
  3. R Business Analysis R͸ͲΜͳݴޠʁ ౷ܭղੳ޲͚ͷϓϩάϥϛϯάݴޠ ୭Ͱ΋࢖͑Δʂ ແྉͰ Windows ʹ΋ Mac

    ʹ΋ରԠ ͍ͭͰ΋࢖͑Δ গͳ͍ίʔυͰ෼ੳ݁Ռ΍άϥϑΛૉૣ͘ग़ྗ 4
  4. R Business Analysis • ॲཧ଎౓͕༏Ε͓ͯΓɺϏοάσʔλΛ෼ੳ͢Δࡍʹޮ཰త • ExcelͰ͸Ή͔͍ͣ͠౷ܭ෼ੳ͕ग़དྷΔ • ྫ :

    Ϋϥελʔ෼ੳ, όεέοτ෼ੳ(ΞιγΤʔγϣϯ෼ੳ) • ༷ʑͳύοέʔδΛ׆༻͢Δ͜ͱͰ෼ੳͷ෯͕޿͛ΒΕΔ • άϥϑͷඳըʹڧ͍ • ggplot2ͰͷάϥϑԽ͸ࣗ༝౓͕ߴ͘ɺࢹೝੑ͕ߴ͍ ɹɹɹͷओͳϝϦοτ
  5. R Business Analysis ൺֱ಺༰ OS Mac,Windows,Linux WindowsϝΠϯ Macͩͱ෼ੳػೳ͕ෆࣗ༝ ॲཧ଎౓ ˚

    X ѻ͑Δσʔλྔ ʓ (150ສߦͷಡΈࠐΈ΋Մೳ) X (1,048,576 ߦɺ16,384 ྻ) ֦ுੑ ʓ ˚ GUI ˚ ʓ Ձ֨ ແྉ ༗ྉʢ݄਺ઍԁʙʣ ར༻༻్ ౷ܭղੳ දܭࢉ΍ࢿྉ࡞੒ͳͲଟ༷
  6. R Business Analysis ɹɹɹͷΠϯετʔϧ 1. CRANʢThe Comprehensive R Archive NetworkʣʹΞ

    Ϋηε https://cran.r-project.org/ 2. ࢖༻͍ͯ͠ΔOSʹ͋ΘͤͯRͷΠϯετʔϥʔΛμ΢ϯ ϩʔυ ύοέʔδ͕ಈ͔ͳ͍͜ͱ͕ແ͍Α͏ʹ࠷৽൛Λ 3. μ΢ϯϩʔυͨ͠ϑΝΠϧΛ։͍ͯΠϯετʔϧ
  7. R Business Analysis αϯϓϧίʔυ 2 ^ 5 a <- 100

    b <- 2 a * b list <- c(2,4,6,8,10) list
  8. R Business Analysis ͷΠϯετʔϧ 1. ͍ΘΏΔ RͷIDE (౷߹։ൃ؀ڥ)Ͱ͢ɻ εΫϦϓτϑΝΠϧɺ࣮ߦconsoleɺάϥϑεϖʔεɺ ಡΈࠐΜͩσʔλͷҰཡͳͲ͕ݟ΍͘͢഑ஔ͞Ε·͢

    2. R studioͷΠϯετʔϥΛμ΢ϯϩʔυ https://www.rstudio.com/products/rstudio/download/ 3. μ΢ϯϩʔυͨ͠ΠϯετʔϥΛ։͍ͯΠϯετʔϧ
  9. R Business Analysis • ೖྗิॿ͕ڧ͍ • άϥϑͷΞ΢τϓοτ͕͠΍͍͢ • ΤσΟλͷจࣈ৭ͱഎܠΛฤू͠ ͯɺݟ΍͍͢ઃఆʹͰ͖Δ

    • ෳ਺ͷεΫϦϓτϑΝΠϧΛλϒͰ ։͍͓͚ͯΔ • ύοέʔδϦετͷӾཡ΍σΟϨΫ τϦϑΝΠϧͷ֬ೝͳͲ͕Ͱ͖Δ ͷϝϦοτ
  10. R Business Analysis άϥϑΛॻ͍ͯΈΑ͏ʂ x <- 1:10 y <- 1:10

    plot(x, y) # x࣠Λ10͔Β1ͷฒͼํʹ͢Δ plot(x, y, xlim=c(10,1))
  11. R Business Analysis ๮άϥϑΛॻ͍ͯΈΑ͏ʂ # άϥϑͰ೔ຊޠΛදࣔ͢Δઃఆ par(family = "HiraKakuProN-W3") #

    ฏۉ৞਺๮άϥϑΛඳը͢Δ barplot(data$ڭཆޘָ, names.arg = data$༻్෼ྨ, las = 3)