SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
1
Agenda
Read data from
xls
xlsx
SAS
SPSS
STATA
•
•
•
•
•
2
Libraries
library(readxl)
library(haven)
3
Overview
list sheets in an excel file
read data from an excel sheet
read specific cells
read specific rows
read specific columns
•
•
•
•
•
4
List Sheets
excel_sheets('sample.xls')
## [1] "ecom"
5
Read Sheet
read_excel('sample.xls', sheet = 1)
## # A tibble: 7 x 5
## channel users new_users sessions bounce_rate
## <chr> <dbl> <dbl> <dbl> <chr>
## 1 Organic Search 43296 40238 50810 48.72%
## 2 Direct 12916 12311 16419 49.27%
## 3 Referral 10983 7636 18105 22.26%
## 4 Social 10346 10029 11101 61.92%
## 5 Display 5564 4790 7220 83.30%
## 6 Paid Search 2687 2205 3438 38.02%
## 7 Affiliates 1773 1585 2167 55.75%
6
7
Read Specific Cells
read_excel('sample.xls', sheet = 1, range = "B1:C4")
## # A tibble: 3 x 2
## users new_users
## <dbl> <dbl>
## 1 43296 40238
## 2 12916 12311
## 3 10983 7636
8
9
Read Specific Cells
read_excel('sample.xls', sheet = 1, col_names = FALSE,
range = anchored("A4", dim = c(3, 2)))
## # A tibble: 3 x 2
## ..1 ..2
## <chr> <dbl>
## 1 Referral 10983
## 2 Social 10346
## 3 Display 5564
10
11
Read Specific Cells
read_excel('sample.xls', sheet = 1,
range = cell_limits(c(1, 1), c(6, 4)))
## # A tibble: 5 x 4
## channel users new_users sessions
## <chr> <dbl> <dbl> <dbl>
## 1 Organic Search 43296 40238 50810
## 2 Direct 12916 12311 16419
## 3 Referral 10983 7636 18105
## 4 Social 10346 10029 11101
## 5 Display 5564 4790 7220
12
Read Specific Cells
read_excel('sample.xls', sheet = 1,
range = cell_limits(c(1, 2), c(NA, NA)))
## # A tibble: 7 x 4
## users new_users sessions bounce_rate
## <dbl> <dbl> <dbl> <chr>
## 1 43296 40238 50810 48.72%
## 2 12916 12311 16419 49.27%
## 3 10983 7636 18105 22.26%
## 4 10346 10029 11101 61.92%
## 5 5564 4790 7220 83.30%
## 6 2687 2205 3438 38.02%
## 7 1773 1585 2167 55.75%
13
Read Specific Cells
read_excel('sample.xls', sheet = 1,
range = cell_limits(c(1, NA), c(NA, 2)))
## # A tibble: 7 x 2
## channel users
## <chr> <dbl>
## 1 Organic Search 43296
## 2 Direct 12916
## 3 Referral 10983
## 4 Social 10346
## 5 Display 5564
## 6 Paid Search 2687
## 7 Affiliates 1773
14
Read Single Column
read_excel('sample.xls', sheet = 1, range = cell_cols(2))
## # A tibble: 7 x 1
## users
## <dbl>
## 1 43296
## 2 12916
## 3 10983
## 4 10346
## 5 5564
## 6 2687
## 7 1773
15
Read Specific Rows
read_excel('sample.xls', sheet = 1, range = cell_rows(1:4))
## # A tibble: 3 x 5
## channel users new_users sessions bounce_rate
## <chr> <dbl> <dbl> <dbl> <chr>
## 1 Organic Search 43296 40238 50810 48.72%
## 2 Direct 12916 12311 16419 49.27%
## 3 Referral 10983 7636 18105 22.26%
16
Read Specific Columns
read_excel('sample.xls', sheet = 1, range = cell_cols(2:3))
## # A tibble: 7 x 2
## users new_users
## <dbl> <dbl>
## 1 43296 40238
## 2 12916 12311
## 3 10983 7636
## 4 10346 10029
## 5 5564 4790
## 6 2687 2205
## 7 1773 1585
17
18
Statistical Softwares
SAS
SPSS
STATA
•
•
•
19
STATA
read_stata('airline.dta')
## # A tibble: 32 x 6
## year y w r l k
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1948 1.21 0.243 0.145 1.41 0.612
## 2 1949 1.35 0.260 0.218 1.38 0.559
## 3 1950 1.57 0.278 0.316 1.39 0.573
## 4 1951 1.95 0.297 0.394 1.55 0.564
## 5 1952 2.27 0.310 0.356 1.80 0.574
## 6 1953 2.73 0.322 0.359 1.93 0.711
## 7 1954 3.03 0.335 0.403 1.96 0.776
## 8 1955 3.56 0.350 0.396 2.12 0.827
## 9 1956 3.98 0.361 0.382 2.43 0.800
## 10 1957 4.42 0.379 0.305 2.71 0.921
## # ... with 22 more rows
20
SPSS
read_spss('employee.sav')
## # A tibble: 474 x 9
## id gender educ jobcat salary salbegin jobtime prevexp mi
## <dbl> <chr+l> <dbl+l> <dbl+l> <dbl+> <dbl+lb> <dbl+l> <dbl+lbl> <d
## 1 1 m [Mal~ 15 [15] 3 [Man~ 57000 27000 98 144
## 2 2 m [Mal~ 16 [16] 1 [Cle~ 40200 18750 98 36
## 3 3 f [Fem~ 12 [12] 1 [Cle~ 21450 12000 98 381
## 4 4 f [Fem~ 8 [8] 1 [Cle~ 21900 13200 98 190
## 5 5 m [Mal~ 15 [15] 1 [Cle~ 45000 21000 98 138
## 6 6 m [Mal~ 15 [15] 1 [Cle~ 32100 13500 98 67
## 7 7 m [Mal~ 15 [15] 1 [Cle~ 36000 18750 98 114
## 8 8 f [Fem~ 12 [12] 1 [Cle~ 21900 9750 98 0 [mis~
## 9 9 f [Fem~ 15 [15] 1 [Cle~ 27900 12750 98 115
## 10 10 f [Fem~ 12 [12] 1 [Cle~ 24000 13500 98 244
## # ... with 464 more rows
21
SAS
read_sas('airline.sas7bdat')
## # A tibble: 32 x 6
## YEAR Y W R L K
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1948 1.21 0.243 0.145 1.41 0.612
## 2 1949 1.35 0.260 0.218 1.38 0.559
## 3 1950 1.57 0.278 0.316 1.39 0.573
## 4 1951 1.95 0.297 0.394 1.55 0.564
## 5 1952 2.27 0.310 0.356 1.80 0.574
## 6 1953 2.73 0.322 0.359 1.93 0.711
## 7 1954 3.03 0.335 0.403 1.96 0.776
## 8 1955 3.56 0.350 0.396 2.12 0.827
## 9 1956 3.98 0.361 0.382 2.43 0.800
## 10 1957 4.42 0.379 0.305 2.71 0.921
## # ... with 22 more rows
22
23
24

Weitere ähnliche Inhalte

Was ist angesagt?

Seistech SQL code
Seistech SQL codeSeistech SQL code
Seistech SQL code
Simon Hoyle
 
Python data structures
Python data structuresPython data structures
Python data structures
Harry Potter
 

Was ist angesagt? (16)

M12 random forest-part01
M12 random forest-part01M12 random forest-part01
M12 random forest-part01
 
M11 bagging loo cv
M11 bagging loo cvM11 bagging loo cv
M11 bagging loo cv
 
Seistech SQL code
Seistech SQL codeSeistech SQL code
Seistech SQL code
 
Merging tables using R
Merging tables using R Merging tables using R
Merging tables using R
 
M09-Cross validating-naive-bayes
M09-Cross validating-naive-bayesM09-Cross validating-naive-bayes
M09-Cross validating-naive-bayes
 
Data handling in r
Data handling in rData handling in r
Data handling in r
 
Getting started with R when analysing GitHub commits
Getting started with R when analysing GitHub commitsGetting started with R when analysing GitHub commits
Getting started with R when analysing GitHub commits
 
Python data structures
Python data structuresPython data structures
Python data structures
 
Data manipulation on r
Data manipulation on rData manipulation on r
Data manipulation on r
 
Apache Pig Relational Operators - II
Apache Pig Relational Operators - II Apache Pig Relational Operators - II
Apache Pig Relational Operators - II
 
Computer practicals(part) Class 12
Computer practicals(part) Class 12Computer practicals(part) Class 12
Computer practicals(part) Class 12
 
R code for data manipulation
R code for data manipulationR code for data manipulation
R code for data manipulation
 
Very basic functional design patterns
Very basic functional design patternsVery basic functional design patterns
Very basic functional design patterns
 
The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Trace
 
Python testing-frameworks overview
Python testing-frameworks overviewPython testing-frameworks overview
Python testing-frameworks overview
 
Adventures on live partitioning
Adventures on live partitioningAdventures on live partitioning
Adventures on live partitioning
 

Ähnlich wie Read data from Excel spreadsheets into R

INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docxINFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
carliotwaycave
 
Data manipulation and visualization in r 20190711 myanmarucsy
Data manipulation and visualization in r 20190711 myanmarucsyData manipulation and visualization in r 20190711 myanmarucsy
Data manipulation and visualization in r 20190711 myanmarucsy
SmartHinJ
 

Ähnlich wie Read data from Excel spreadsheets into R (20)

fINAL Lesson_5_Data_Manipulation_using_R_v1.pptx
fINAL Lesson_5_Data_Manipulation_using_R_v1.pptxfINAL Lesson_5_Data_Manipulation_using_R_v1.pptx
fINAL Lesson_5_Data_Manipulation_using_R_v1.pptx
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
2013.11.14 Big Data Workshop Bruno Voisin
2013.11.14 Big Data Workshop Bruno Voisin 2013.11.14 Big Data Workshop Bruno Voisin
2013.11.14 Big Data Workshop Bruno Voisin
 
Regression and Classification with R
Regression and Classification with RRegression and Classification with R
Regression and Classification with R
 
Basic R Data Manipulation
Basic R Data ManipulationBasic R Data Manipulation
Basic R Data Manipulation
 
R programming language
R programming languageR programming language
R programming language
 
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docxINFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
INFORMATIVE ESSAYThe purpose of the Informative Essay assignme.docx
 
MySQL Integral DB Design #JAB14
MySQL Integral DB Design #JAB14MySQL Integral DB Design #JAB14
MySQL Integral DB Design #JAB14
 
Ggplot2 v3
Ggplot2 v3Ggplot2 v3
Ggplot2 v3
 
R programming
R programmingR programming
R programming
 
Data manipulation and visualization in r 20190711 myanmarucsy
Data manipulation and visualization in r 20190711 myanmarucsyData manipulation and visualization in r 20190711 myanmarucsy
Data manipulation and visualization in r 20190711 myanmarucsy
 
R_Proficiency.pptx
R_Proficiency.pptxR_Proficiency.pptx
R_Proficiency.pptx
 
Mat lab
Mat labMat lab
Mat lab
 
Introduction to MySQL Query Tuning for Dev[Op]s
Introduction to MySQL Query Tuning for Dev[Op]sIntroduction to MySQL Query Tuning for Dev[Op]s
Introduction to MySQL Query Tuning for Dev[Op]s
 
R learning by examples
R learning by examplesR learning by examples
R learning by examples
 
第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)
第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)
第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)
 
ADVANCE ITT BY PRASAD
ADVANCE ITT BY PRASADADVANCE ITT BY PRASAD
ADVANCE ITT BY PRASAD
 
01_introduction_lab.pdf
01_introduction_lab.pdf01_introduction_lab.pdf
01_introduction_lab.pdf
 
Optimizing queries MySQL
Optimizing queries MySQLOptimizing queries MySQL
Optimizing queries MySQL
 
Python SQLite3...
Python                                                                SQLite3...Python                                                                SQLite3...
Python SQLite3...
 

Mehr von Rsquared Academy

Mehr von Rsquared Academy (20)

Handling Date & Time in R
Handling Date & Time in RHandling Date & Time in R
Handling Date & Time in R
 
Joining Data with dplyr
Joining Data with dplyrJoining Data with dplyr
Joining Data with dplyr
 
Variables & Data Types in R
Variables & Data Types in RVariables & Data Types in R
Variables & Data Types in R
 
How to install & update R packages?
How to install & update R packages?How to install & update R packages?
How to install & update R packages?
 
How to get help in R?
How to get help in R?How to get help in R?
How to get help in R?
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
RMySQL Tutorial For Beginners
RMySQL Tutorial For BeginnersRMySQL Tutorial For Beginners
RMySQL Tutorial For Beginners
 
R Markdown Tutorial For Beginners
R Markdown Tutorial For BeginnersR Markdown Tutorial For Beginners
R Markdown Tutorial For Beginners
 
R Data Visualization Tutorial: Bar Plots
R Data Visualization Tutorial: Bar PlotsR Data Visualization Tutorial: Bar Plots
R Data Visualization Tutorial: Bar Plots
 
R Programming: Introduction to Matrices
R Programming: Introduction to MatricesR Programming: Introduction to Matrices
R Programming: Introduction to Matrices
 
R Programming: Introduction to Vectors
R Programming: Introduction to VectorsR Programming: Introduction to Vectors
R Programming: Introduction to Vectors
 
R Programming: Variables & Data Types
R Programming: Variables & Data TypesR Programming: Variables & Data Types
R Programming: Variables & Data Types
 
Data Visualization With R: Learn To Combine Multiple Graphs
Data Visualization With R: Learn To Combine Multiple GraphsData Visualization With R: Learn To Combine Multiple Graphs
Data Visualization With R: Learn To Combine Multiple Graphs
 
R Data Visualization: Learn To Add Text Annotations To Plots
R Data Visualization: Learn To Add Text Annotations To PlotsR Data Visualization: Learn To Add Text Annotations To Plots
R Data Visualization: Learn To Add Text Annotations To Plots
 
Data Visualization With R: Learn To Modify Font Of Graphical Parameters
Data Visualization With R: Learn To Modify Font Of Graphical ParametersData Visualization With R: Learn To Modify Font Of Graphical Parameters
Data Visualization With R: Learn To Modify Font Of Graphical Parameters
 
Data Visualization With R: Learn To Modify Color Of Plots
Data Visualization With R: Learn To Modify Color Of PlotsData Visualization With R: Learn To Modify Color Of Plots
Data Visualization With R: Learn To Modify Color Of Plots
 
Data Visualization With R: Learn To Modify Title, Axis Labels & Range
Data Visualization With R: Learn To Modify Title, Axis Labels & RangeData Visualization With R: Learn To Modify Title, Axis Labels & Range
Data Visualization With R: Learn To Modify Title, Axis Labels & Range
 
Data Visualization With R: Introduction
Data Visualization With R: IntroductionData Visualization With R: Introduction
Data Visualization With R: Introduction
 
Data Visualization With R
Data Visualization With RData Visualization With R
Data Visualization With R
 
R Programming: Mathematical Functions In R
R Programming: Mathematical Functions In RR Programming: Mathematical Functions In R
R Programming: Mathematical Functions In R
 

Kürzlich hochgeladen

一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
q6pzkpark
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
ahmedjiabur940
 
怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制
怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制
怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制
vexqp
 
怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制
怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制
怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制
vexqp
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
Health
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
wsppdmt
 
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
vexqp
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
nirzagarg
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
gajnagarg
 
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
vexqp
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
nirzagarg
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
wsppdmt
 

Kürzlich hochgeladen (20)

一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
 
怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制
怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制
怎样办理纽约州立大学宾汉姆顿分校毕业证(SUNY-Bin毕业证书)成绩单学校原版复制
 
Switzerland Constitution 2002.pdf.........
Switzerland Constitution 2002.pdf.........Switzerland Constitution 2002.pdf.........
Switzerland Constitution 2002.pdf.........
 
怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制
怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制
怎样办理伦敦大学毕业证(UoL毕业证书)成绩单学校原版复制
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
 
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptxThe-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Aspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - AlmoraAspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - Almora
 
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
 
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATIONCapstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
 
Data Analyst Tasks to do the internship.pdf
Data Analyst Tasks to do the internship.pdfData Analyst Tasks to do the internship.pdf
Data Analyst Tasks to do the internship.pdf
 
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
 
Ranking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRanking and Scoring Exercises for Research
Ranking and Scoring Exercises for Research
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
 

Read data from Excel spreadsheets into R

  • 1. 1
  • 4. Overview list sheets in an excel file read data from an excel sheet read specific cells read specific rows read specific columns • • • • • 4
  • 6. Read Sheet read_excel('sample.xls', sheet = 1) ## # A tibble: 7 x 5 ## channel users new_users sessions bounce_rate ## <chr> <dbl> <dbl> <dbl> <chr> ## 1 Organic Search 43296 40238 50810 48.72% ## 2 Direct 12916 12311 16419 49.27% ## 3 Referral 10983 7636 18105 22.26% ## 4 Social 10346 10029 11101 61.92% ## 5 Display 5564 4790 7220 83.30% ## 6 Paid Search 2687 2205 3438 38.02% ## 7 Affiliates 1773 1585 2167 55.75% 6
  • 7. 7
  • 8. Read Specific Cells read_excel('sample.xls', sheet = 1, range = "B1:C4") ## # A tibble: 3 x 2 ## users new_users ## <dbl> <dbl> ## 1 43296 40238 ## 2 12916 12311 ## 3 10983 7636 8
  • 9. 9
  • 10. Read Specific Cells read_excel('sample.xls', sheet = 1, col_names = FALSE, range = anchored("A4", dim = c(3, 2))) ## # A tibble: 3 x 2 ## ..1 ..2 ## <chr> <dbl> ## 1 Referral 10983 ## 2 Social 10346 ## 3 Display 5564 10
  • 11. 11
  • 12. Read Specific Cells read_excel('sample.xls', sheet = 1, range = cell_limits(c(1, 1), c(6, 4))) ## # A tibble: 5 x 4 ## channel users new_users sessions ## <chr> <dbl> <dbl> <dbl> ## 1 Organic Search 43296 40238 50810 ## 2 Direct 12916 12311 16419 ## 3 Referral 10983 7636 18105 ## 4 Social 10346 10029 11101 ## 5 Display 5564 4790 7220 12
  • 13. Read Specific Cells read_excel('sample.xls', sheet = 1, range = cell_limits(c(1, 2), c(NA, NA))) ## # A tibble: 7 x 4 ## users new_users sessions bounce_rate ## <dbl> <dbl> <dbl> <chr> ## 1 43296 40238 50810 48.72% ## 2 12916 12311 16419 49.27% ## 3 10983 7636 18105 22.26% ## 4 10346 10029 11101 61.92% ## 5 5564 4790 7220 83.30% ## 6 2687 2205 3438 38.02% ## 7 1773 1585 2167 55.75% 13
  • 14. Read Specific Cells read_excel('sample.xls', sheet = 1, range = cell_limits(c(1, NA), c(NA, 2))) ## # A tibble: 7 x 2 ## channel users ## <chr> <dbl> ## 1 Organic Search 43296 ## 2 Direct 12916 ## 3 Referral 10983 ## 4 Social 10346 ## 5 Display 5564 ## 6 Paid Search 2687 ## 7 Affiliates 1773 14
  • 15. Read Single Column read_excel('sample.xls', sheet = 1, range = cell_cols(2)) ## # A tibble: 7 x 1 ## users ## <dbl> ## 1 43296 ## 2 12916 ## 3 10983 ## 4 10346 ## 5 5564 ## 6 2687 ## 7 1773 15
  • 16. Read Specific Rows read_excel('sample.xls', sheet = 1, range = cell_rows(1:4)) ## # A tibble: 3 x 5 ## channel users new_users sessions bounce_rate ## <chr> <dbl> <dbl> <dbl> <chr> ## 1 Organic Search 43296 40238 50810 48.72% ## 2 Direct 12916 12311 16419 49.27% ## 3 Referral 10983 7636 18105 22.26% 16
  • 17. Read Specific Columns read_excel('sample.xls', sheet = 1, range = cell_cols(2:3)) ## # A tibble: 7 x 2 ## users new_users ## <dbl> <dbl> ## 1 43296 40238 ## 2 12916 12311 ## 3 10983 7636 ## 4 10346 10029 ## 5 5564 4790 ## 6 2687 2205 ## 7 1773 1585 17
  • 18. 18
  • 20. STATA read_stata('airline.dta') ## # A tibble: 32 x 6 ## year y w r l k ## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 1948 1.21 0.243 0.145 1.41 0.612 ## 2 1949 1.35 0.260 0.218 1.38 0.559 ## 3 1950 1.57 0.278 0.316 1.39 0.573 ## 4 1951 1.95 0.297 0.394 1.55 0.564 ## 5 1952 2.27 0.310 0.356 1.80 0.574 ## 6 1953 2.73 0.322 0.359 1.93 0.711 ## 7 1954 3.03 0.335 0.403 1.96 0.776 ## 8 1955 3.56 0.350 0.396 2.12 0.827 ## 9 1956 3.98 0.361 0.382 2.43 0.800 ## 10 1957 4.42 0.379 0.305 2.71 0.921 ## # ... with 22 more rows 20
  • 21. SPSS read_spss('employee.sav') ## # A tibble: 474 x 9 ## id gender educ jobcat salary salbegin jobtime prevexp mi ## <dbl> <chr+l> <dbl+l> <dbl+l> <dbl+> <dbl+lb> <dbl+l> <dbl+lbl> <d ## 1 1 m [Mal~ 15 [15] 3 [Man~ 57000 27000 98 144 ## 2 2 m [Mal~ 16 [16] 1 [Cle~ 40200 18750 98 36 ## 3 3 f [Fem~ 12 [12] 1 [Cle~ 21450 12000 98 381 ## 4 4 f [Fem~ 8 [8] 1 [Cle~ 21900 13200 98 190 ## 5 5 m [Mal~ 15 [15] 1 [Cle~ 45000 21000 98 138 ## 6 6 m [Mal~ 15 [15] 1 [Cle~ 32100 13500 98 67 ## 7 7 m [Mal~ 15 [15] 1 [Cle~ 36000 18750 98 114 ## 8 8 f [Fem~ 12 [12] 1 [Cle~ 21900 9750 98 0 [mis~ ## 9 9 f [Fem~ 15 [15] 1 [Cle~ 27900 12750 98 115 ## 10 10 f [Fem~ 12 [12] 1 [Cle~ 24000 13500 98 244 ## # ... with 464 more rows 21
  • 22. SAS read_sas('airline.sas7bdat') ## # A tibble: 32 x 6 ## YEAR Y W R L K ## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 1948 1.21 0.243 0.145 1.41 0.612 ## 2 1949 1.35 0.260 0.218 1.38 0.559 ## 3 1950 1.57 0.278 0.316 1.39 0.573 ## 4 1951 1.95 0.297 0.394 1.55 0.564 ## 5 1952 2.27 0.310 0.356 1.80 0.574 ## 6 1953 2.73 0.322 0.359 1.93 0.711 ## 7 1954 3.03 0.335 0.403 1.96 0.776 ## 8 1955 3.56 0.350 0.396 2.12 0.827 ## 9 1956 3.98 0.361 0.382 2.43 0.800 ## 10 1957 4.42 0.379 0.305 2.71 0.921 ## # ... with 22 more rows 22
  • 23. 23
  • 24. 24