More minor page count tweaks & fixes
And re-convert with latest htmlbook
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<section data-type="chapter" id="chp-spreadsheets">
|
||||
<h1><span id="sec-import-spreadsheets" class="quarto-section-identifier d-none d-lg-block"><span class="chapter-title">Spreadsheets</span></span></h1>
|
||||
<section id="introduction" data-type="sect1">
|
||||
<section id="spreadsheets-introduction" data-type="sect1">
|
||||
<h1>
|
||||
Introduction</h1>
|
||||
<p>So far, you have learned about importing data from plain text files, e.g., <code>.csv</code> and <code>.tsv</code> files. Sometimes you need to analyze data that lives in a spreadsheet. This chapter will introduce you to tools for working with data in Excel spreadsheets and Google Sheets. This will build on much of what you’ve learned in <a href="#chp-data-import" data-type="xref">#chp-data-import</a>, but we will also discuss additional considerations and complexities when working with data from spreadsheets.</p>
|
||||
@@ -11,7 +11,7 @@ Introduction</h1>
|
||||
<h1>
|
||||
Excel</h1>
|
||||
|
||||
<section id="prerequisites" data-type="sect2">
|
||||
<section id="spreadsheets-prerequisites" data-type="sect2">
|
||||
<h2>
|
||||
Prerequisites</h2>
|
||||
<p>In this section, you’ll learn how to load data from Excel spreadsheets in R with the <strong>readxl</strong> package. This package is non-core tidyverse, so you need to load it explicitly, but it is installed automatically when you install the tidyverse package.</p>
|
||||
@@ -190,15 +190,16 @@ Reading worksheets</h2>
|
||||
<div class="cell">
|
||||
<pre data-type="programlisting" data-code-language="r">read_excel("data/penguins.xlsx", sheet = "Torgersen Island")
|
||||
#> # A tibble: 52 × 8
|
||||
#> species island bill_length_mm bill_depth_mm flipper_length_mm body_mass_g
|
||||
#> <chr> <chr> <chr> <chr> <chr> <chr>
|
||||
#> 1 Adelie Torgers… 39.1 18.7 181 3750
|
||||
#> 2 Adelie Torgers… 39.5 17.399999999… 186 3800
|
||||
#> 3 Adelie Torgers… 40.2999999999… 18 195 3250
|
||||
#> 4 Adelie Torgers… NA NA NA NA
|
||||
#> 5 Adelie Torgers… 36.7000000000… 19.3 193 3450
|
||||
#> 6 Adelie Torgers… 39.2999999999… 20.6 190 3650
|
||||
#> # … with 46 more rows, and 2 more variables: sex <chr>, year <dbl></pre>
|
||||
#> species island bill_length_mm bill_depth_mm flipper_length_mm
|
||||
#> <chr> <chr> <chr> <chr> <chr>
|
||||
#> 1 Adelie Torgersen 39.1 18.7 181
|
||||
#> 2 Adelie Torgersen 39.5 17.399999999999999 186
|
||||
#> 3 Adelie Torgersen 40.299999999999997 18 195
|
||||
#> 4 Adelie Torgersen NA NA NA
|
||||
#> 5 Adelie Torgersen 36.700000000000003 19.3 193
|
||||
#> 6 Adelie Torgersen 39.299999999999997 20.6 190
|
||||
#> # … with 46 more rows, and 3 more variables: body_mass_g <chr>, sex <chr>,
|
||||
#> # year <dbl></pre>
|
||||
</div>
|
||||
<p>Some variables that appear to contain numerical data are read in as characters due to the character string <code>"NA"</code> not being recognized as a true <code>NA</code>.</p>
|
||||
<div class="cell">
|
||||
@@ -206,15 +207,16 @@ Reading worksheets</h2>
|
||||
|
||||
penguins_torgersen
|
||||
#> # A tibble: 52 × 8
|
||||
#> species island bill_length_mm bill_depth_mm flipper_length_mm body_mass_g
|
||||
#> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
|
||||
#> 1 Adelie Torgers… 39.1 18.7 181 3750
|
||||
#> 2 Adelie Torgers… 39.5 17.4 186 3800
|
||||
#> 3 Adelie Torgers… 40.3 18 195 3250
|
||||
#> 4 Adelie Torgers… NA NA NA NA
|
||||
#> 5 Adelie Torgers… 36.7 19.3 193 3450
|
||||
#> 6 Adelie Torgers… 39.3 20.6 190 3650
|
||||
#> # … with 46 more rows, and 2 more variables: sex <chr>, year <dbl></pre>
|
||||
#> species island bill_length_mm bill_depth_mm flipper_length_mm
|
||||
#> <chr> <chr> <dbl> <dbl> <dbl>
|
||||
#> 1 Adelie Torgersen 39.1 18.7 181
|
||||
#> 2 Adelie Torgersen 39.5 17.4 186
|
||||
#> 3 Adelie Torgersen 40.3 18 195
|
||||
#> 4 Adelie Torgersen NA NA NA
|
||||
#> 5 Adelie Torgersen 36.7 19.3 193
|
||||
#> 6 Adelie Torgersen 39.3 20.6 190
|
||||
#> # … with 46 more rows, and 3 more variables: body_mass_g <dbl>, sex <chr>,
|
||||
#> # year <dbl></pre>
|
||||
</div>
|
||||
<p>Alternatively, you can use <code><a href="https://readxl.tidyverse.org/reference/excel_sheets.html">excel_sheets()</a></code> to get information on all worksheets in an Excel spreadsheet, and then read the one(s) you’re interested in.</p>
|
||||
<div class="cell">
|
||||
@@ -240,15 +242,16 @@ dim(penguins_dream)
|
||||
<pre data-type="programlisting" data-code-language="r">penguins <- bind_rows(penguins_torgersen, penguins_biscoe, penguins_dream)
|
||||
penguins
|
||||
#> # A tibble: 344 × 8
|
||||
#> species island bill_length_mm bill_depth_mm flipper_length_mm body_mass_g
|
||||
#> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
|
||||
#> 1 Adelie Torgers… 39.1 18.7 181 3750
|
||||
#> 2 Adelie Torgers… 39.5 17.4 186 3800
|
||||
#> 3 Adelie Torgers… 40.3 18 195 3250
|
||||
#> 4 Adelie Torgers… NA NA NA NA
|
||||
#> 5 Adelie Torgers… 36.7 19.3 193 3450
|
||||
#> 6 Adelie Torgers… 39.3 20.6 190 3650
|
||||
#> # … with 338 more rows, and 2 more variables: sex <chr>, year <dbl></pre>
|
||||
#> species island bill_length_mm bill_depth_mm flipper_length_mm
|
||||
#> <chr> <chr> <dbl> <dbl> <dbl>
|
||||
#> 1 Adelie Torgersen 39.1 18.7 181
|
||||
#> 2 Adelie Torgersen 39.5 17.4 186
|
||||
#> 3 Adelie Torgersen 40.3 18 195
|
||||
#> 4 Adelie Torgersen NA NA NA
|
||||
#> 5 Adelie Torgersen 36.7 19.3 193
|
||||
#> 6 Adelie Torgersen 39.3 20.6 190
|
||||
#> # … with 338 more rows, and 3 more variables: body_mass_g <dbl>, sex <chr>,
|
||||
#> # year <dbl></pre>
|
||||
</div>
|
||||
<p>In <a href="#chp-iteration" data-type="xref">#chp-iteration</a> we’ll talk about ways of doing this sort of task without repetitive code.</p>
|
||||
</section>
|
||||
@@ -277,14 +280,14 @@ deaths <- read_excel(deaths_path)
|
||||
#> • `` -> `...6`
|
||||
deaths
|
||||
#> # A tibble: 18 × 6
|
||||
#> `Lots of people` ...2 ...3 ...4 ...5 ...6
|
||||
#> <chr> <chr> <chr> <chr> <chr> <chr>
|
||||
#> 1 simply cannot resist writing <NA> <NA> <NA> <NA> some …
|
||||
#> 2 at the top <NA> of their…
|
||||
#> 3 or merging <NA> <NA> <NA> cells
|
||||
#> 4 Name Profession Age Has kids Date of birth Date …
|
||||
#> 5 David Bowie musician 69 TRUE 17175 42379
|
||||
#> 6 Carrie Fisher actor 60 TRUE 20749 42731
|
||||
#> `Lots of people` ...2 ...3 ...4 ...5 ...6
|
||||
#> <chr> <chr> <chr> <chr> <chr> <chr>
|
||||
#> 1 simply cannot resi… <NA> <NA> <NA> <NA> some notes
|
||||
#> 2 at the top <NA> of their spreadsh…
|
||||
#> 3 or merging <NA> <NA> <NA> cells
|
||||
#> 4 Name Profession Age Has kids Date of birth Date of death
|
||||
#> 5 David Bowie musician 69 TRUE 17175 42379
|
||||
#> 6 Carrie Fisher actor 60 TRUE 20749 42731
|
||||
#> # … with 12 more rows</pre>
|
||||
</div>
|
||||
<p>The top three rows and the bottom four rows are not part of the data frame.</p>
|
||||
@@ -292,29 +295,29 @@ deaths
|
||||
<div class="cell">
|
||||
<pre data-type="programlisting" data-code-language="r">read_excel(deaths_path, skip = 4)
|
||||
#> # A tibble: 14 × 6
|
||||
#> Name Profession Age `Has kids` `Date of birth` `Date of death`
|
||||
#> <chr> <chr> <chr> <chr> <dttm> <chr>
|
||||
#> 1 David Bowie musician 69 TRUE 1947-01-08 00:00:00 42379
|
||||
#> 2 Carrie Fis… actor 60 TRUE 1956-10-21 00:00:00 42731
|
||||
#> 3 Chuck Berry musician 90 TRUE 1926-10-18 00:00:00 42812
|
||||
#> 4 Bill Paxton actor 61 TRUE 1955-05-17 00:00:00 42791
|
||||
#> 5 Prince musician 57 TRUE 1958-06-07 00:00:00 42481
|
||||
#> 6 Alan Rickm… actor 69 FALSE 1946-02-21 00:00:00 42383
|
||||
#> # … with 8 more rows</pre>
|
||||
#> Name Profession Age `Has kids` `Date of birth`
|
||||
#> <chr> <chr> <chr> <chr> <dttm>
|
||||
#> 1 David Bowie musician 69 TRUE 1947-01-08 00:00:00
|
||||
#> 2 Carrie Fisher actor 60 TRUE 1956-10-21 00:00:00
|
||||
#> 3 Chuck Berry musician 90 TRUE 1926-10-18 00:00:00
|
||||
#> 4 Bill Paxton actor 61 TRUE 1955-05-17 00:00:00
|
||||
#> 5 Prince musician 57 TRUE 1958-06-07 00:00:00
|
||||
#> 6 Alan Rickman actor 69 FALSE 1946-02-21 00:00:00
|
||||
#> # … with 8 more rows, and 1 more variable: `Date of death` <chr></pre>
|
||||
</div>
|
||||
<p>We could also set <code>n_max</code> to omit the extraneous rows at the bottom.</p>
|
||||
<div class="cell">
|
||||
<pre data-type="programlisting" data-code-language="r">read_excel(deaths_path, skip = 4, n_max = 10)
|
||||
#> # A tibble: 10 × 6
|
||||
#> Name Profession Age `Has kids` `Date of birth` `Date of death`
|
||||
#> <chr> <chr> <dbl> <lgl> <dttm> <dttm>
|
||||
#> 1 David … musician 69 TRUE 1947-01-08 00:00:00 2016-01-10 00:00:00
|
||||
#> 2 Carrie… actor 60 TRUE 1956-10-21 00:00:00 2016-12-27 00:00:00
|
||||
#> 3 Chuck … musician 90 TRUE 1926-10-18 00:00:00 2017-03-18 00:00:00
|
||||
#> 4 Bill P… actor 61 TRUE 1955-05-17 00:00:00 2017-02-25 00:00:00
|
||||
#> 5 Prince musician 57 TRUE 1958-06-07 00:00:00 2016-04-21 00:00:00
|
||||
#> 6 Alan R… actor 69 FALSE 1946-02-21 00:00:00 2016-01-14 00:00:00
|
||||
#> # … with 4 more rows</pre>
|
||||
#> Name Profession Age `Has kids` `Date of birth`
|
||||
#> <chr> <chr> <dbl> <lgl> <dttm>
|
||||
#> 1 David Bowie musician 69 TRUE 1947-01-08 00:00:00
|
||||
#> 2 Carrie Fisher actor 60 TRUE 1956-10-21 00:00:00
|
||||
#> 3 Chuck Berry musician 90 TRUE 1926-10-18 00:00:00
|
||||
#> 4 Bill Paxton actor 61 TRUE 1955-05-17 00:00:00
|
||||
#> 5 Prince musician 57 TRUE 1958-06-07 00:00:00
|
||||
#> 6 Alan Rickman actor 69 FALSE 1946-02-21 00:00:00
|
||||
#> # … with 4 more rows, and 1 more variable: `Date of death` <dttm></pre>
|
||||
</div>
|
||||
<p>Another approach is using cell ranges. In Excel, the top left cell is <code>A1</code>. As you move across columns to the right, the cell label moves down the alphabet, i.e. <code>B1</code>, <code>C1</code>, etc. And as you move down a column, the number in the cell label increases, i.e. <code>A2</code>, <code>A3</code>, etc.</p>
|
||||
<p>The data we want to read in starts in cell <code>A5</code> and ends in cell <code>F15</code>. In spreadsheet notation, this is <code>A5:F15</code>.</p>
|
||||
@@ -332,7 +335,7 @@ deaths
|
||||
</li>
|
||||
</ul></section>
|
||||
|
||||
<section id="data-types" data-type="sect2">
|
||||
<section id="spreadsheets-data-types" data-type="sect2">
|
||||
<h2>
|
||||
Data types</h2>
|
||||
<p>In CSV files, all values are strings. This is not particularly true to the data, but it is simple: everything is a string.</p>
|
||||
@@ -399,7 +402,7 @@ write_xlsx(bake_sale, path = "data/bake-sale.xlsx")</pre>
|
||||
<section id="formatted-output" data-type="sect2">
|
||||
<h2>
|
||||
Formatted output</h2>
|
||||
<p>The readxl package is a light-weight solution for writing a simple Excel spreadsheet, but if you’re interested in additional features like writing to sheets within a spreadsheet and styling, you will want to use the <strong>openxlsx</strong> package. Note that this package is not part of the tidyverse so the functions and workflows may feel unfamiliar. For example, function names are camelCase, multiple functions can’t be composed in pipelines, and arguments are in a different order than they tend to be in the tidyverse. However, this is ok. As your R learning and usage expands outside of this book you will encounter lots of different styles used in various R packages that you might need to use to accomplish specific goals in R. A good way of familiarizing yourself with the coding style used in a new package is to run the examples provided in function documentation to get a feel for the syntax and the output formats as well as reading any vignettes that might come with the package.</p>
|
||||
<p>The writexl package is a light-weight solution for writing a simple Excel spreadsheet, but if you’re interested in additional features like writing to sheets within a spreadsheet and styling, you will want to use the <strong>openxlsx</strong> package. Note that this package is not part of the tidyverse so the functions and workflows may feel unfamiliar. For example, function names are camelCase, multiple functions can’t be composed in pipelines, and arguments are in a different order than they tend to be in the tidyverse. However, this is ok. As your R learning and usage expands outside of this book you will encounter lots of different styles used in various R packages that you might need to use to accomplish specific goals in R. A good way of familiarizing yourself with the coding style used in a new package is to run the examples provided in function documentation to get a feel for the syntax and the output formats as well as reading any vignettes that might come with the package.</p>
|
||||
<p>Below we show how to write a spreadsheet with three sheets, one for each species of penguins in the <code>penguins</code> data frame.</p>
|
||||
<div class="cell">
|
||||
<pre data-type="programlisting" data-code-language="r">library(openxlsx)
|
||||
@@ -466,7 +469,7 @@ writeDataTable(
|
||||
<p>See <a href="https://ycphs.github.io/openxlsx/articles/Formatting.html" class="uri">https://ycphs.github.io/openxlsx/articles/Formatting.html</a> for an extensive discussion on further formatting functionality for data written from R to Excel with openxlsx.</p>
|
||||
</section>
|
||||
|
||||
<section id="exercises" data-type="sect2">
|
||||
<section id="spreadsheets-exercises" data-type="sect2">
|
||||
<h2>
|
||||
Exercises</h2>
|
||||
<ol type="1"><li>
|
||||
@@ -595,8 +598,8 @@ Read sheets</h2>
|
||||
<p>The first argument to <code><a href="https://googlesheets4.tidyverse.org/reference/range_read.html">read_sheet()</a></code> is the URL of the file to read. You can also access this file via <a href="https://pos.it/r4ds-students" class="uri">https://pos.it/r4ds-students</a>, however note that at the time of writing this book you can’t read a sheet directly from a short link.</p>
|
||||
<div class="cell">
|
||||
<pre data-type="programlisting" data-code-language="r">students <- read_sheet("https://docs.google.com/spreadsheets/d/1V1nPp1tzOuutXFLb3G9Eyxi3qxeEhnOXUzL5_BcCQ0w/edit?usp=sharing")
|
||||
#> ✔ Reading from "students".
|
||||
#> ✔ Range 'Sheet1'.</pre>
|
||||
#> ✔ Reading from students.
|
||||
#> ✔ Range Sheet1.</pre>
|
||||
</div>
|
||||
<p><code><a href="https://googlesheets4.tidyverse.org/reference/range_read.html">read_sheet()</a></code> will read the file in as a tibble.</p>
|
||||
<div class="cell">
|
||||
@@ -624,8 +627,8 @@ Read sheets</h2>
|
||||
age = if_else(age == "five", "5", age),
|
||||
age = parse_number(age)
|
||||
)
|
||||
#> ✔ Reading from "students".
|
||||
#> ✔ Range '2:10000000'.
|
||||
#> ✔ Reading from students.
|
||||
#> ✔ Range 2:10000000.
|
||||
|
||||
students
|
||||
#> # A tibble: 6 × 5
|
||||
@@ -642,18 +645,19 @@ students
|
||||
<p>It’s also possible to read individual sheets from Google Sheets as well. Let’s read the penguins Google Sheet at <a href="https://pos.it/r4ds-penguins" class="uri">https://pos.it/r4ds-penguins</a>, and specifically the “Torgersen Island” sheet in it.</p>
|
||||
<div class="cell">
|
||||
<pre data-type="programlisting" data-code-language="r">read_sheet("https://docs.google.com/spreadsheets/d/1aFu8lnD_g0yjF5O-K6SFgSEWiHPpgvFCF0NY9D6LXnY/edit?usp=sharing", sheet = "Torgersen Island")
|
||||
#> ✔ Reading from "penguins".
|
||||
#> ✔ Reading from penguins.
|
||||
#> ✔ Range ''Torgersen Island''.
|
||||
#> # A tibble: 52 × 8
|
||||
#> species island bill_length_mm bill_depth_mm flipper_length_mm body_mass_g
|
||||
#> <chr> <chr> <list> <list> <list> <list>
|
||||
#> 1 Adelie Torgers… <dbl [1]> <dbl [1]> <dbl [1]> <dbl [1]>
|
||||
#> 2 Adelie Torgers… <dbl [1]> <dbl [1]> <dbl [1]> <dbl [1]>
|
||||
#> 3 Adelie Torgers… <dbl [1]> <dbl [1]> <dbl [1]> <dbl [1]>
|
||||
#> 4 Adelie Torgers… <chr [1]> <chr [1]> <chr [1]> <chr [1]>
|
||||
#> 5 Adelie Torgers… <dbl [1]> <dbl [1]> <dbl [1]> <dbl [1]>
|
||||
#> 6 Adelie Torgers… <dbl [1]> <dbl [1]> <dbl [1]> <dbl [1]>
|
||||
#> # … with 46 more rows, and 2 more variables: sex <chr>, year <dbl></pre>
|
||||
#> species island bill_length_mm bill_depth_mm flipper_length_mm
|
||||
#> <chr> <chr> <list> <list> <list>
|
||||
#> 1 Adelie Torgersen <dbl [1]> <dbl [1]> <dbl [1]>
|
||||
#> 2 Adelie Torgersen <dbl [1]> <dbl [1]> <dbl [1]>
|
||||
#> 3 Adelie Torgersen <dbl [1]> <dbl [1]> <dbl [1]>
|
||||
#> 4 Adelie Torgersen <chr [1]> <chr [1]> <chr [1]>
|
||||
#> 5 Adelie Torgersen <dbl [1]> <dbl [1]> <dbl [1]>
|
||||
#> 6 Adelie Torgersen <dbl [1]> <dbl [1]> <dbl [1]>
|
||||
#> # … with 46 more rows, and 3 more variables: body_mass_g <list>, sex <chr>,
|
||||
#> # year <dbl></pre>
|
||||
</div>
|
||||
<p>You can obtain a list of all sheets within a Google Sheet with <code><a href="https://googlesheets4.tidyverse.org/reference/sheet_properties.html">sheet_names()</a></code>:</p>
|
||||
<div class="cell">
|
||||
@@ -664,19 +668,19 @@ students
|
||||
<div class="cell">
|
||||
<pre data-type="programlisting" data-code-language="r">deaths_url <- gs4_example("deaths")
|
||||
deaths <- read_sheet(deaths_url, range = "A5:F15")
|
||||
#> ✔ Reading from "deaths".
|
||||
#> ✔ Range 'A5:F15'.
|
||||
#> ✔ Reading from deaths.
|
||||
#> ✔ Range A5:F15.
|
||||
deaths
|
||||
#> # A tibble: 10 × 6
|
||||
#> Name Profession Age `Has kids` `Date of birth` `Date of death`
|
||||
#> <chr> <chr> <dbl> <lgl> <dttm> <dttm>
|
||||
#> 1 David … musician 69 TRUE 1947-01-08 00:00:00 2016-01-10 00:00:00
|
||||
#> 2 Carrie… actor 60 TRUE 1956-10-21 00:00:00 2016-12-27 00:00:00
|
||||
#> 3 Chuck … musician 90 TRUE 1926-10-18 00:00:00 2017-03-18 00:00:00
|
||||
#> 4 Bill P… actor 61 TRUE 1955-05-17 00:00:00 2017-02-25 00:00:00
|
||||
#> 5 Prince musician 57 TRUE 1958-06-07 00:00:00 2016-04-21 00:00:00
|
||||
#> 6 Alan R… actor 69 FALSE 1946-02-21 00:00:00 2016-01-14 00:00:00
|
||||
#> # … with 4 more rows</pre>
|
||||
#> Name Profession Age `Has kids` `Date of birth`
|
||||
#> <chr> <chr> <dbl> <lgl> <dttm>
|
||||
#> 1 David Bowie musician 69 TRUE 1947-01-08 00:00:00
|
||||
#> 2 Carrie Fisher actor 60 TRUE 1956-10-21 00:00:00
|
||||
#> 3 Chuck Berry musician 90 TRUE 1926-10-18 00:00:00
|
||||
#> 4 Bill Paxton actor 61 TRUE 1955-05-17 00:00:00
|
||||
#> 5 Prince musician 57 TRUE 1958-06-07 00:00:00
|
||||
#> 6 Alan Rickman actor 69 FALSE 1946-02-21 00:00:00
|
||||
#> # … with 4 more rows, and 1 more variable: `Date of death` <dttm></pre>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -700,7 +704,7 @@ Authentication</h2>
|
||||
<p>When you attempt to read in a sheet that requires authentication, googlesheets4 will direct you to a web browser with a prompt to sign in to your Google account and grant permission to operate on your behalf with Google Sheets. However, if you want to specify a specific Google account, authentication scope, etc. you can do so with <code><a href="https://googlesheets4.tidyverse.org/reference/gs4_auth.html">gs4_auth()</a></code>, e.g. <code>gs4_auth(email = "mine@example.com")</code>, which will force the use of a token associated with a specific email. For further authentication details, we recommend reading the documentation googlesheets4 auth vignette: <a href="https://googlesheets4.tidyverse.org/articles/auth.html" class="uri">https://googlesheets4.tidyverse.org/articles/auth.html</a>.</p>
|
||||
</section>
|
||||
|
||||
<section id="exercises-1" data-type="sect2">
|
||||
<section id="spreadsheets-exercises-1" data-type="sect2">
|
||||
<h2>
|
||||
Exercises</h2>
|
||||
<ol type="1"><li><p>Read the <code>students</code> dataset from earlier in the chapter from Excel and also from Google Sheets, with no additional arguments supplied to the <code><a href="https://readxl.tidyverse.org/reference/read_excel.html">read_excel()</a></code> and <code><a href="https://googlesheets4.tidyverse.org/reference/range_read.html">read_sheet()</a></code> functions. Are the resulting data frames in R exactly the same? If not, how are they different?</p></li>
|
||||
@@ -728,7 +732,7 @@ Exercises</h2>
|
||||
</ol></section>
|
||||
</section>
|
||||
|
||||
<section id="summary" data-type="sect1">
|
||||
<section id="spreadsheets-summary" data-type="sect1">
|
||||
<h1>
|
||||
Summary</h1>
|
||||
<p>In this chapter you learned how to read data into R from spreadsheets: from Microsoft Excel with <code><a href="https://readxl.tidyverse.org/reference/read_excel.html">read_excel()</a></code> from the readxl package and from Google Sheets with <code><a href="https://googlesheets4.tidyverse.org/reference/range_read.html">read_sheet()</a></code> from the googlesheets4 package. These functions work very similarly to each other and have similar arguments for specifying column names, NA strings, rows to skip on top of the file you’re reading in, etc. Additionally, both functions make it possible to read a single sheet from a spreadsheet as well.</p>
|
||||
|
||||
Reference in New Issue
Block a user