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

68th Tokyo.R Beginner session1

68th Tokyo.R Beginner session1

第68回Tokyo.Rの初心者セッション1:data import/exportのスライドです。

kilometer

March 03, 2018
Tweet

More Decks by kilometer

Other Decks in Technology

Transcript

  1.     @kilometer BeginneR Session 1 -- Data

    Import / Export -- 2018.03.03 at Shiodome
  2. Who   @kilometer  Postdoc (Ph.D engineering)  

    Animal Behavior Neuro Imaging Medical Engineering R ~ 10 years?  : 
  3. Input Output Today’s talk ? ? Table data Image data

    Other formats Introduction Summary
  4. !   #      $"

         $    $    
  5. #  %       &$

      ! & ! &  "       
  6.    !    "  

      "  "   
  7.    !    "  

      "  "   
  8. RStudio > Project .H21474836474<: G RStudio 7@ ,R&-%("#+!')0FC ,')JA!3? ,')6=!("#+!3<

    RStudio!E1  ฤू్தͷ಺༰Λอ࣋  D5921474836472R*-$-QOL!;8/ BI >   34UVEJPͬͯͳΜͩʁ 1SPKFDUͬͯͳΜͩ !XBLVUFLB https://qiita.com/wakuteka/items/9599bb0a8985d98928d7
  9. RStudio > Project R   +(  .'"& 

    #%"$ RStudio)!  *- , #%"&   34UVEJPͬͯͳΜͩʁ 1SPKFDUͬͯͳΜͩ !XBLVUFLB https://qiita.com/wakuteka/items/9599bb0a8985d98928d7
  10. Input Output Today’s talk ? ? Table data Image data

    Other formats Summary Introduction
  11. Table format data Comma-separated values (.csv) Tab-separated values (.tsv) Space-SV

    Semicolon-SV … Delimiter-separated values or Character-SV
  12.        Import Table format

    data object assignment operator file path function
  13.        Import Table format

    data object assignment operator file path function
  14. ~/Documents/ import.txt  data      

               or 1. set working directory 2. then use relative path Method②: use absolute path Method ① Import Table format data
  15. prj ~/Documents/R prj.Rproj import.txt Default working directory (project root) 

          can use relative path without  
  16. ) ! ( ) ! ! ( ) ∖ #

    " !( !! ! (( # ! (( # ! (( # " ( ! # " ( ( ( () # ( ( ) ( # () # ( ! ! (( ( # ( ( # " ( !! ! # ! # ( ( () ) ! # ! # ( ( "" #) !! ( ( ! ( () # ( ( ) ( !) () # ( ( ) ( ! # # # # # # # ) ,) ( ! Import Table format data
  17. ) ! ( ) ! ! ( ) ∖ #

    " !( !! ! (( # ! (( # ! (( # " ( ! # " ( ( ( () # ( ( ) ( # () # ( ! ! (( ( # ( ( # " ( !! ! # ! # ( ( () ) ! # ! # ( ( "" #) !! ( ( ! ( () # ( ( ) ( !) () # ( ( ) ( ! # # # # # # # ) ,) ( ! Import Table format data
  18.   Usage read.table(file, skip = 0, header = FALSE,

    nrows = -1, row.names, fileEncoding = "") Import Table format data
  19. cf. R-Tips: 40.     http://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html  

                  Import Table format data
  20. " " " " " cf. R-Tips: 40.  

      http://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html Import Table format data
  21. " " " " " cf. R-Tips: 40.  

      http://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html Import Table format data
  22. " " " " " cf. R-Tips: 40.  

      http://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html Import Table format data
  23. " " " " " cf. R-Tips: 40.  

      http://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html Import Table format data
  24. " " " " " cf. R-Tips: 40.  

    # $ http://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html Import Table format data # &_"# $ # " # "/!  # %"
  25. " " " " " cf. R-Tips: 40.  

    # $ http://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html Import Table format data # &_"# $ # " # "/!  # %"
  26.          

      ∖        Import Table format data Wrap
  27. Package Default pkgs Package Package Package CRAN Guithub Package Package

    Package Package Package Package Package Package       
  28.      Import Table format data Default

    installed pkg (optional) Function     Install REQUIRED
  29. Import Table format data      

     Installation (from CRAN)     Usage          or
  30. Import Table format data      

            Fast!!! Flexible!!! Need installation Should specify: data.table =FALSE Automatic!!! Simple!!!
  31.          

       object file path Export Table format data Wrapper
  32. Input Output Today’s talk ? ? Table data Image data

    Other formats Summary Introduction
  33. Export image data Use Graphic Device ready graphic device close

    graphic device draw graph(s) plotting functions High-level Low-level Interactive Basic Graphics in R http://bcb.dfci.harvard.edu/~aedin/courses/BiocDec2011/2.Plotting.pdf
  34. Export image data Use Graphic Device ready close draw 

             High-level plotting function
  35. Export image data Graphic Devices in    

                          
  36.   ready graphic device close graphic device draw graph(s)

    Image data processing Import & Export image        processing
  37.   Import image data     

          
  38.   Import image data     

          
  39. Import image data       

        Export image data       # not CRAN pkg       # low googlability !
  40. Import image data       

        Export image data       # not CRAN pkg       # low googlability !
  41. Input Output Today’s talk ? ? Table data Image data

    Other formats Summary Introduction
  42. .sas or .dta or .sav SAS Stata SPSS  

                      
  43. Data Import / Export ? ?    

                       packages