Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
68th Tokyo.R Beginner session1
kilometer
March 03, 2018
Technology
1
610
68th Tokyo.R Beginner session1
第68回Tokyo.Rの初心者セッション1:data import/exportのスライドです。
kilometer
March 03, 2018
Tweet
Share
More Decks by kilometer
See All by kilometer
TokyoR#103_DataProcessing
kilometer
0
520
TokyoR#102_RMarkdown
kilometer
1
390
TokyoR#101_RegressionAnalysis
kilometer
0
190
TokyoR#99_Divergence
kilometer
1
180
TokyoR#98_TextAnalysis
kilometer
0
360
Tokyo.R #97 Data Visualization
kilometer
1
210
Tokyo.R #96 theory of probability
kilometer
5
2.3k
Bayesian statistics Tokyo.R#94
kilometer
5
2.2k
統計関連学会連合大会チュートリアル資料
kilometer
6
2.7k
Other Decks in Technology
See All in Technology
Technologies for developing editors / Webエディタ開発を支える技術
shuta13
1
230
NGINXENG JP#2 - 3-NGINX Plus・プロダクトのアップデート
hiropo20
0
180
Hasuraの本番運用に向けて
nori3tsu
0
280
Kubernetes_EKSに入門してみる
toru_kubota
0
230
Astroで始める爆速個人サイト開発
takanorip
12
8.4k
ECテックカンファレンス2023 EC事業部のモバイル開発2023
tatsumi0000
0
180
Virtual Thread - 導入の背景と、効果的な使い方 -
skrb
3
260
Red Hatが ひっそりと開発しているOSSデータストア
chiroito
0
110
- Rでオブジェクト指向プログラミング- クラス設計入門の入門
kotatyamtema
1
710
SignalR を使ったアプリケーション開発をより快適に!
nenonaninu
0
490
ステート管理を超えるRecoil運用の考え方
uhyo
7
5.5k
ROS_Japan_UG_#49_LT
maeharakeisuke
0
200
Featured
See All Featured
Bash Introduction
62gerente
601
210k
Agile that works and the tools we love
rasmusluckow
320
20k
Faster Mobile Websites
deanohume
295
29k
How GitHub Uses GitHub to Build GitHub
holman
465
280k
BBQ
matthewcrist
75
8.1k
Automating Front-end Workflow
addyosmani
1351
200k
The Cult of Friendly URLs
andyhume
68
5.1k
Designing on Purpose - Digital PM Summit 2013
jponch
108
5.9k
Typedesign – Prime Four
hannesfritz
34
1.5k
No one is an island. Learnings from fostering a developers community.
thoeni
12
1.5k
Designing with Data
zakiwarfel
91
4.2k
How New CSS Is Changing Everything About Graphic Design on the Web
jensimmons
214
12k
Transcript
@kilometer BeginneR Session 1 -- Data
Import / Export -- 2018.03.03 at Shiodome
Who
Who @kilometer Postdoc (Ph.D engineering)
Animal Behavior Neuro Imaging Medical Engineering R ~ 10 years? :
BeginneR Session
Before After BeginneR Session
Input Output Today’s talk ? ? Table data Image data
Other formats Introduction Summary
! # $"
$ $
# % &$
! & ! & "
! "
" "
! "
" "
Input Output Do NOT start from here
Input Output Do NOT start from here Whatever …
Input Output Do NOT start from here Whatever … 1
2 3
Input Output Today’s talk ? ?
Integrated Development Environment RStudio https://www.rstudio.com/ !
Integrated Development Environment RStudio https://www.rstudio.com/
RStudio
Projects RStudio
RStudio > Project .H21474836474<: G RStudio
[email protected]
,R&-%("#+!')0FC ,')JA!3? ,')6=!("#+!3<
RStudio!E1 ฤू్தͷ༰Λอ࣋ D5921474836472R*-$-QOL!;8/ BI > 34UVEJPͬͯͳΜͩʁ 1SPKFDUͬͯͳΜͩ !XBLVUFLB https://qiita.com/wakuteka/items/9599bb0a8985d98928d7
RStudio > Project R +( .'"&
#%"$ RStudio)! *- , #%"& 34UVEJPͬͯͳΜͩʁ 1SPKFDUͬͯͳΜͩ !XBLVUFLB https://qiita.com/wakuteka/items/9599bb0a8985d98928d7
File > New Project… > New Directory > New Project
hogehoge
hogehoge ~/Documents/R hogehoge.Rproj .Rproj.user Project Root Directory Double click!! .RData
.Rhistory Auto saved project information Open project New!!
~/Documents/R project1 project2 project3 project4
Input Output Today’s talk ? ? Table data Image data
Other formats Summary Introduction
Table format data Table data Image data Other formats Introduction
Summary
Table format data Comma-separated values (.csv) Tab-separated values (.tsv) Space-SV
Semicolon-SV … Delimiter-separated values or Character-SV
Import Table format
data object assignment operator file path function
Import Table format
data object assignment operator file path function
~/Documents/ import.txt data
or 1. set working directory 2. then use relative path Method②: use absolute path Method ① Import Table format data
# # Method②: use absolute path Method ①: setwd –
relative path " # or
prj ~/Documents/R prj.Rproj import.txt Default working directory (project root)
can use relative path without
Import Table format data
Import Table format data
) ! ( ) ! ! ( ) ∖ #
" !( !! ! (( # ! (( # ! (( # " ( ! # " ( ( ( () # ( ( ) ( # () # ( ! ! (( ( # ( ( # " ( !! ! # ! # ( ( () ) ! # ! # ( ( "" #) !! ( ( ! ( () # ( ( ) ( !) () # ( ( ) ( ! # # # # # # # ) ,) ( ! Import Table format data
) ! ( ) ! ! ( ) ∖ #
" !( !! ! (( # ! (( # ! (( # " ( ! # " ( ( ( () # ( ( ) ( # () # ( ! ! (( ( # ( ( # " ( !! ! # ! # ( ( () ) ! # ! # ( ( "" #) !! ( ( ! ( () # ( ( ) ( !) () # ( ( ) ( ! # # # # # # # ) ,) ( ! Import Table format data
Usage read.table(file, skip = 0, header = FALSE,
nrows = -1, row.names, fileEncoding = "") Import Table format data
cf. R-Tips: 40. http://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html
Import Table format data
" " " " " cf. R-Tips: 40.
http://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html Import Table format data
" " " " " cf. R-Tips: 40.
http://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html Import Table format data
" " " " " cf. R-Tips: 40.
http://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html Import Table format data
" " " " " cf. R-Tips: 40.
http://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html Import Table format data
" " " " " cf. R-Tips: 40.
# $ http://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html Import Table format data # &_"# $ # " # "/! # %"
" " " " " cf. R-Tips: 40.
# $ http://cse.naro.affrc.go.jp/takezawa/r-tips/r/40.html Import Table format data # &_"# $ # " # "/! # %"
67 1 @y__mattu https://github.com/ymattu/TokyoR67 Import Table format data
∖ Import Table format data Wrap
Import Table format data
Wrappers
Import Table format data
Wrappers
Package … {utils} Package {base} Package
Package Package Package Package Package Package Package Package Package Package
Package Package Package Package Package
packages
cf. http://rpkg.gepuro.net/ cf. https://cran.r-project.org/web/packages/ at 2018.02.20
Package Default pkgs Package Package Package CRAN Guithub Package Package
Package Package Package Package Package Package
Import Table format data Default
installed pkg (optional) Function Install REQUIRED
Import Table format data List of installed packages
Import Table format data
Installation (from CRAN) Usage or
Import Table format data Global environment # Attach {data.table}
Import Table format data
Fast!!! Flexible!!! Need installation Should specify: data.table =FALSE Automatic!!! Simple!!!
object file path Export Table format data Wrapper
Input Output Today’s talk ? ? Table data Image data
Other formats Summary Introduction
Image data Table data Image data Other formats Summary Introduction
Export image data ?
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
Export image data Use Graphic Device ready close draw
High-level plotting function
hogehoge ~/Documents/R hogehoge.Rproj hoge.png New!!
Export image data Graphic Devices in
Export image data Graphic Devices in
ready graphic device close graphic device draw graph(s)
Image data processing Import & Export image processing
Import image data
Import image data
Import image data
Import image data
Import image data
Export image data # not CRAN pkg # low googlability !
Import image data
Export image data # not CRAN pkg # low googlability !
None
None
None
Salvador Dalí 1904-1989 profile of time wikipedia
http://seekr.jp/
None
None
Input Output Today’s talk ? ? Table data Image data
Other formats Summary Introduction
Table data Image data Other formats Other formats Summary Introduction
.xls or .xlsx GJMFQBUI
TIFFUOBNFPS/P
.json Wrap
Wrap
.wav or .mp3
.sas or .dta or .sav SAS Stata SPSS
Table data Image data Other formats Summary Introduction
Input Output Do NOT start from here Whatever … 1
2 3
Data Import / Export ? ?
packages
Data Import / Export ? ?
packages
~/Documents/R project1 project2 project3 project4
Before After BeginneR Session ?
! KMT©
KMT©