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

BeginnerSession2_67th_TokyoR

8284465a94bbdf1ea82cf1a67d55f447?s=47 kilometer
January 20, 2018

 BeginnerSession2_67th_TokyoR

BeginnerSession2 alisw

8284465a94bbdf1ea82cf1a67d55f447?s=128

kilometer

January 20, 2018
Tweet

Transcript

  1.         @kilometer Beginner’s

    Session 2 -- data manipulation --
  2. Who  @kilometer  Postdoc (Ph.D engineering)  Behavioral System

    Neuro Imaging Medical System Engineering R ~ 10 years? : Kyoto
  3. ’ Basic Technics to be Freedom in R Beginner to

    Intermediate level
  4.  Think Write Run Read

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

  6. Think Write  Read Freely Stress-fee

  7. Language Thought

  8. George Boole 1815 - 1864 A Class-Room Introduction to Logic

    https://niyamaklogic.wordpress.co m/category/laws-of-thoughts/ Mathematician Philosopher &
  9.  Boolean Algebra    George Boole 1815 -

    1864       # equal to # not equal to # or # and # is A in B? wikipedia
  10.  # is A in B?  Boolean Algebra 

      # is A in B?  
  11. Think Write  Read Freely Stress-fee

  12. Basic Technics to be Freedom in R Pipe algebra Verb

    functions data.frame
  13. Basic Technics to be Freedom in R data.frame What is?

    Access Handling
  14. What is “data.frame” data.frame is a “list” looks like a

    “matrix” list: a set of “vector”(s) vector: 1 dimensional object
  15. vector in Excel

  16. vector in R in Excel     

                   
  17. vector         

               
  18. vector         

         
  19.  vector seq{base} Sequence Generation Description Generate regular sequences. seq

    is a standard generic with a default method. … Usage seq(...) ## Default S3 method: seq(from = 1, to = 1, by = ((to - from)/(length.out - 1)), length.out = NULL, along.with = NULL, ...)
  20. vector         

                
  21. vector         

          
  22. What is “data.frame” data.frame is a “list” looks like a

    “matrix” list: a set of “vector”(s) vector: a one direction object ☑
  23. list         

           
  24. list         

               
  25. list         

           
  26. list         

                       
  27. What is “data.frame” data.frame is a “list” looks like a

    “matrix” list: a set of “vector”(s) vector: 1 dimentional object ☑ ☑
  28. data.frame in R in Excel     

         
  29. data.frame         >

    df1 id value 1 a 11 2 b 12 3 c 13 4 d 14 5 e 15 > df1$value[2:3] [1] 12 13 > df1[5, 2] [1] 15 row column
  30. data.frame         

    > df1 id value 1 a 11 2 b 12 3 c 13 4 d 14 5 e 15 > df1$value[2:3] [1] 12 13 > df1[5, 2] [1] 15 row column column row
  31. data.frame         >

    summary(df1) id value a:1 Min. :11 b:1 1st Qu.:12 c:1 Median :13 d:1 Mean :13 e:1 3rd Qu.:14 Max. :15
  32. data.frame         

    > str(df1) 'data.frame': 5 obs. of 2 variables: $ id : Factor w/ 5 levels "a","b","c","d",… $ data: int 11 12 13 14 15
  33. data.frame         >

    str(df1) 'data.frame': 5 obs. of 2 variables: $ id : Factor w/ 5 levels "a","b","c","d",… $ value: int 11 12 13 14 15 row column
  34. data.frame $ > str(iris) row column $ " " $

    ' ' ' ' "$ "
  35. data.frame  > head(iris)      

                                
  36. data.frame  > plot(iris)

  37.  Boolean Algebra   George Boole 1815 - 1864

          # equal to # not equal to # or # and # is A in B? wikipedia
  38. data.frame $ ' row column row column > str(iris1) '

    $ ' $ ' ' ' row column Boolean
  39. $ ( data.frame ) $ ( ( ( $ (

    $ $ $ ( ) ( ) ( ) $ $ $ $ $ $ ) ) )
  40. in Excel Basic Technics to be Freedom in R in

    R      
  41. 

  42.  more

  43. Basic Technics to be Freedom in R Pipe algebra data.frame

  44. 1JQFBMHFCSB         

            {magrittr} dplyr  yutanihilation https://speakerdeck.com/yutannihilation/dplyrzai-ru-men-ji-ben-bian
  45. {magrittr} 8@("* 6 ("* /=?.; 4 13   

     A("*B$)&   -9 5:<1 R#+,'%!072>https://rlangradio.org/ 1JQFBMHFCSB 
  46. {magrittr}       #  

                       #              1JQFBMHFCSB  
  47. {magrittr} #        

        *OQVU 0VUQVU ① ② ③ 5IJOLJOHGMPX 4USVDUVSF 1JQFBMHFCSB  
  48. {magrittr} #        

           *OQVU 0VUQVU 5IJOLJOHGMPX 3FBEJOHqPX 1JQFBMHFCSB  
  49. {magrittr} #        

                    */ 065 5IJOLJOH 4USVDUVSF 1JQFBMHFCSB 
  50. {magrittr} #        

                      */ 065 5IJOLJOH 3FBEJOH 1JQFBMHFCSB 
  51. {magrittr} #        

                       1JQFBMHFCSB 
  52. {magrittr} #     */ 065  

                         ① ② ③ */ 065 */ 065 5IJOLJOH 3FBEJOH 1JQFBMHFCSB  
  53. {magrittr} #    536&*/ 5FNQPSBM065   

                       ① ② ③ 5FNQ*/ 5FNQ065 5FNQ065 536&065 5IJOLJOH 3FBEJOH 1JQFBMHFCSB  
  54. {magrittr} #   536&*/     

                           536&065 5IJOLJOH 3FBEJOH 1JQFBMHFCSB 
  55. {magrittr} #        

                      */ 065 1JQFBMHFCSB 
  56. {magrittr} #        

                       */ 065 1JQFBMHFCSB 
  57. {magrittr} #        

                            */ 065 EPU 1JQFBMHFCSB 
  58.          

          {magrittr} ͜Ε 1JQFBMHFCSB 
  59. {magrittr}         

             “Passive” writing “Active” writing B AF   A F B 1JQFBMHFCSB  
  60. {magrittr} " ( (. $ (" ( "(") ) (

    ( $ ) , (" ) ' % % $ ' " % $ % % $ " % $ ' " ) ( , ) ) ) ) ( "(") 1JQFBMHFCSB
  61. {magrittr} %$ 0 " $,, $ $ $' , ,

    ( ( . $ % ) % '", ' ) % $ , ' , % '", ' , % $ , ' ) $ ,( / % . % ,( $', 1JQFBMHFCSB
  62. {magrittr} * 0"06 ,"(0*220 *0*1 0$., 120 *12 . 1%

    4 -3, 0.2"2*.- -3, "220 %*,-", 1 *12 . $)0 " -(2) " *%2) $)0 $ -2 0 ", % -3, "220 -", 1 $)0 " -(2) 1$" .(* 5 -3, 1JQFBMHFCSB
  63. {magrittr} tee algebra    chaindichika http://d.hatena.ne.jp/dichika/20140731/p1 1JQFBMHFCSB

  64. Think Write  Read Freely Stress-fee Sequential =

  65.         http://maker.usoko.net/nounai/

  66.         http://maker.usoko.net/nounai/ more

  67. Basic Technics to be Freedom in R Pipe algebra Verb

    functions data.frame
  68.          

     # add column # select column # select row # arrange row # summary of values # fusion two dfs {dplyr} WFSCT WFSCGVODUJPOT
  69. It (dplyr) provides simple “verbs” to help you translate your

    thoughts into code. functions that correspond to the most common data manipulation tasks Introduction to dplyr https://cran.r-project.org/web/packages/dplyr/vignettes/dplyr.html WFSCT {dplyr}
  70. dplyr - ,/  #0'"   (! $* %.

    1) (+) Introduction to dplyr https://cran.r-project.org/web/packages/dplyr/vignettes/dplyr.html WFSCT {dplyr}  &/
  71. WFSCT S V O C M    

    (, , etc)   
  72. WFSCT S V O C M    

    {dplyr}verb
  73. Think Write  Read Freely Seamless Sequential

  74.          

      # add column # select column # select row # arrange row # summary of values # fusion two dfs {dplyr} WFSCT WFSCGVODUJPOT
  75. WFSCT {dplyr}  ΧϥϜͷ௥Ճ + 

  76. %$ 0 )%0 $ $ , , ' (/ ,

    , ( ( . $ % ) % '", ' ) % $ , ' , % '", ' , % $ , ' ) $ ,( / % . % ,( $', WFSCT {dplyr}
  77. %$ * *0 )%0* $*$ , , '*(/ *( '

    , * ( ( . *$ % ) % ' , ' ) % $ , ' , % ' , ' , % $ , ' ) $ ,(* / % . % 1 ,( 2 ' WFSCT {dplyr} over write
  78. WFSCT {dplyr} #  

  79. $ $) )$ $ % % $ % ( $

    % ' ' WFSCT {dplyr}
  80. “ ” % $ $ WFSCT {dplyr} Select help functions

  81. WFSCT {dplyr} # Select help functions    

                  https://kazutan.github.io/blog/2017/04/dplyr-select-memo/ dplyr::selectkazutan
  82.          

      #  #  #  #   #  #   {dplyr} WFSCT WFSCؔ਺܈
  83. WFSCT {dplyr} #  

  84.          

    WFSCT {dplyr} 'data.frame': 50 obs. of 5 variables: $ Sepal.Length: num 7 6.4 6.9 5.5 6.5 5.7 6.3 ... $ Sepal.Width : num 3.2 3.2 3.1 2.3 2.8 2.8 ... $ Petal.Length: num 4.7 4.5 4.9 4 4.6 4.5 4.7 ... $ Petal.Width : num 1.4 1.5 1.5 1.3 1.5 1.3 ... $ Species : Factor w/ 3 levels "setosa","versicolor",..: 2 2 2 2 2 2 2 2 2 2 ...
  85.          

    WFSCT {dplyr} NSE (Non-Standard Evaluation) 'data.frame': 50 obs. of 5 variables: $ Sepal.Length: num 7 6.4 6.9 5.5 6.5 5.7 6.3 ... $ Sepal.Width : num 3.2 3.2 3.1 2.3 2.8 2.8 ... $ Petal.Length: num 4.7 4.5 4.9 4 4.6 4.5 4.7 ... $ Petal.Width : num 1.4 1.5 1.5 1.3 1.5 1.3 ... $ Species : Factor w/ 3 levels "setosa","versicolor",..: 2 2 2 2 2 2 2 2 2 2 ...
  86.      /4&ͷ࿩ NSE (Non-Standard Evaluation) 

         SE (Standard Evaluation) http://dplyr.tidyverse.org/articles/programming.html Programming with dplyr
  87.      /4&ͷ࿩ NSE  df 

      SQL   http://dplyr.tidyverse.org/articles/programming.html Programming with dplyr      
  88.      /4&ͷ࿩ NSE   

        http://dplyr.tidyverse.org/articles/programming.html Programming with dplyr $  " (!&)  (  # %)+* # verb (' ) # noun (' )
  89.         /4&ͷ࿩ Because

    of NSE.. http://dplyr.tidyverse.org/articles/programming.html Programming with dplyr        This do NOT work There is No “my_var” column in df
  90. /4&ͷ࿩         

           dplyrTidyval  https://speakerdeck.com/yutannihilation/dplyrzai-ru-men-tidyevalbian dplyrTidyval yutanihilation
  91. /4&ͷ࿩         

       %  dplyr +,Tidyval)-!' https://speakerdeck.com/yutannihilation/dplyrzai-ru-men-tidyevalbian "*#  . . *$&( dplyr +,Tidyval)-yutanihilation
  92.          

     #  #  #  #   #  #   {dplyr} WFSCT WFSCؔ਺܈
  93. WFSCT {dplyr}   #     

                    
  94. WFSCT {dplyr} # 

  95. WFSCT {dplyr}        

          #                    
  96. WFSCT {dplyr} # 

  97. WFSCT {dplyr} https://twitter.com/yutannihilation/status/551572539697143808 # 

  98. Basic Technics to be Freedom in R Pipe algebra Verb

    functions data.frame  mutate, select, filter, arrange, summaries, join
  99. (SBNNBSPGEBUBNBOJQVMBUJPO By constraining your options, it helps you think about

    your data manipulation challenges. Introduction to dplyr https://cran.r-project.org/web/packages/dplyr/vignettes/dplyr.html
  100. ("% )  &#   $ * !'+ Introduction

    to dplyr https://cran.r-project.org/web/packages/dplyr/vignettes/dplyr.html   !' (SBNNBSPGEBUBNBOJQVMBUJPO
  101.          И

    ́ горь Ф Страви́нский        
  102. https://www.tidyverse.org/

  103. None