From a03d8fafea41b79e53fb15c34e97309bcd1465f6 Mon Sep 17 00:00:00 2001 From: Olivier Roy Date: Thu, 4 Jan 2024 12:24:01 -0500 Subject: [PATCH] Use openxlsx2 instead of openxlsx. --- DESCRIPTION | 2 +- intro.qmd | 2 +- spreadsheets.qmd | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7e4996ebf..a595ee6cc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -24,7 +24,7 @@ Imports: leaflet, maps, nycflights13, - openxlsx, + openxlsx2, palmerpenguins, repurrrsive (>= 1.1.0), tidymodels, diff --git a/intro.qmd b/intro.qmd index aa0a54232..a5f6d9a1c 100644 --- a/intro.qmd +++ b/intro.qmd @@ -207,7 +207,7 @@ For example, we'll use the following packages because they provide interesting d install.packages( c("arrow", "babynames", "curl", "duckdb", "gapminder", "ggrepel", "ggridges", "ggthemes", "hexbin", "janitor", "Lahman", - "leaflet", "maps", "nycflights13", "openxlsx", "palmerpenguins", + "leaflet", "maps", "nycflights13", "openxlsx2", "palmerpenguins", "repurrrsive", "tidymodels", "writexl") ) ``` diff --git a/spreadsheets.qmd b/spreadsheets.qmd index 3d42f18c6..e9ae6d52c 100644 --- a/spreadsheets.qmd +++ b/spreadsheets.qmd @@ -376,11 +376,11 @@ read_excel("data/bake-sale.xlsx") ### Formatted output -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 [openxlsx package](https://ycphs.github.io/openxlsx). -We won't go into the details of using this package here, but we recommend reading for an extensive discussion on further formatting functionality for data written from R to Excel with openxlsx. +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 [openxlsx2 package](https://janmarvin.github.io/openxlsx2/). +We won't go into the details of using this package here, but we recommend reading for an extensive discussion on further formatting functionality for data written from R to Excel with openxlsx2. -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. +Note that this package is not part of the tidyverse. +For example, 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 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. @@ -496,7 +496,7 @@ A good way of familiarizing yourself with the coding style used in a new package print(n = 7) ``` -4. Recreate the `bake_sale` data frame, write it out to an Excel file using the `write.xlsx()` function from the openxlsx package. +4. Recreate the `bake_sale` data frame, write it out to an Excel file using the `write_xlsx()` function from the openxlsx2 package. 5. In @sec-data-import you learned about the `janitor::clean_names()` function to turn column names into snake case. Read the `students.xlsx` file that we introduced earlier in this section and use this function to "clean" the column names.