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

BeginnerSession2_67th_TokyoR

kilometer
January 20, 2018

 BeginnerSession2_67th_TokyoR

BeginnerSession2 alisw

kilometer

January 20, 2018
Tweet

More Decks by kilometer

Other Decks in Technology

Transcript

  1. Who  @kilometer  Postdoc (Ph.D engineering)  Behavioral System

    Neuro Imaging Medical System Engineering R ~ 10 years? : Kyoto
  2. George Boole 1815 - 1864 A Class-Room Introduction to Logic

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

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

      # is A in B?  
  5. What is “data.frame” data.frame is a “list” looks like a

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

                   
  7. vector         

               
  8.  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, ...)
  9. vector         

                
  10. vector         

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

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

           
  13. list         

               
  14. list         

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

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

         
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. data.frame  > head(iris)      

                                
  23.  Boolean Algebra   George Boole 1815 - 1864

          # equal to # not equal to # or # and # is A in B? wikipedia
  24. $ ( data.frame ) $ ( ( ( $ (

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

    R      
  26. 1JQFBMHFCSB         

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

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

                       #              1JQFBMHFCSB  
  29. {magrittr} #        

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

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

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

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

                       1JQFBMHFCSB 
  34. {magrittr} #     */ 065  

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

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

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

                      */ 065 1JQFBMHFCSB 
  38. {magrittr} #        

                       */ 065 1JQFBMHFCSB 
  39. {magrittr} #        

                            */ 065 EPU 1JQFBMHFCSB 
  40.          

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

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

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

    ( ( . $ % ) % '", ' ) % $ , ' , % '", ' , % $ , ' ) $ ,( / % . % ,( $', 1JQFBMHFCSB
  44. {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
  45.          

     # add column # select column # select row # arrange row # summary of values # fusion two dfs {dplyr} WFSCT WFSCGVODUJPOT
  46. 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}
  47. dplyr - ,/  #0'"   (! $* %.

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

    (, , etc)   
  49.          

      # add column # select column # select row # arrange row # summary of values # fusion two dfs {dplyr} WFSCT WFSCGVODUJPOT
  50. %$ 0 )%0 $ $ , , ' (/ ,

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

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

    % ' ' WFSCT {dplyr}
  53. WFSCT {dplyr} # Select help functions    

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

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

    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 ...
  56.          

    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 ...
  57.      /4&ͷ࿩ NSE (Non-Standard Evaluation) 

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

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

        http://dplyr.tidyverse.org/articles/programming.html Programming with dplyr $  " (!&)  (  # %)+* # verb (' ) # noun (' )
  60.         /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
  61. /4&ͷ࿩         

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

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

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

                    
  65. WFSCT {dplyr}        

          #                    
  66. Basic Technics to be Freedom in R Pipe algebra Verb

    functions data.frame  mutate, select, filter, arrange, summaries, join
  67. (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
  68. ("% )  &#   $ * !'+ Introduction

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

    ́ горь Ф Страви́нский