From b76adc0ba0e6cef32439e28d671445d87cce75f3 Mon Sep 17 00:00:00 2001 From: Stephanie Zimmer <stephaniezimmer@gmail.com> Date: Wed, 21 Aug 2024 22:00:52 -0400 Subject: [PATCH 1/8] Update srvyr version to Aug 2024 --- 04-set-up.Rmd | 3 +-- renv.lock | 14 ++++---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/04-set-up.Rmd b/04-set-up.Rmd index 62441d0..dd48d40 100644 --- a/04-set-up.Rmd +++ b/04-set-up.Rmd @@ -412,11 +412,10 @@ towny %>% .by=csd_type) ``` -However, the `.by` syntax is not yet available in {srvyr}: +The `.by` syntax is similarly implemented in {srvyr} for grouped analysis: ```{r} #| label: setup-srvyr-by-alt -#| error: true apistrat_des %>% summarize(api00_mean = survey_mean(api00), api00_median = survey_median(api00), diff --git a/renv.lock b/renv.lock index a090d68..57aa729 100644 --- a/renv.lock +++ b/renv.lock @@ -2051,16 +2051,10 @@ }, "srvyr": { "Package": "srvyr", - "Version": "1.2.0", - "Source": "GitHub", - "RemoteType": "github", - "RemoteHost": "api.github.com", - "RemoteRepo": "srvyr", - "RemoteUsername": "gergness", - "RemoteRef": "HEAD", - "RemoteSha": "1917f75487fa40f2ea6fd4e33323cd9278afb356", + "Version": "1.3.0", + "Source": "Repository", + "Repository": "CRAN", "Requirements": [ - "R", "dplyr", "magrittr", "methods", @@ -2071,7 +2065,7 @@ "tidyselect", "vctrs" ], - "Hash": "c77ebba142d814788bab0092bf102f6d" + "Hash": "11179f4e74e0018168ae9f219809a3f2" }, "srvyrexploR": { "Package": "srvyrexploR", From 95f460d591e13a6299660f4aa927ff32a0ff844d Mon Sep 17 00:00:00 2001 From: Stephanie Zimmer <stephaniezimmer@gmail.com> Date: Wed, 21 Aug 2024 22:01:21 -0400 Subject: [PATCH 2/8] Update HTML description --- index.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.Rmd b/index.Rmd index f2d8b5f..2cdcb1b 100644 --- a/index.Rmd +++ b/index.Rmd @@ -11,7 +11,7 @@ colorlinks: true lot: true lof: true site: bookdown::bookdown_site -description: "Bookdown for CRC Press book on Exploring Complex Survey Data Analysis Using R." +description: "Exploring Complex Survey Data Analysis Using R: A Tidy Introduction with {srvyr} and {survey}" github-repo: tidy-survey-r/tidy-survey-book graphics: yes cover-image: images/BookCover_Final.jpg From 1c9ede0db5810200cc168ec6ca7eee1eb8e92aa7 Mon Sep 17 00:00:00 2001 From: Isabella Velasquez <ivelasq@gmail.com> Date: Thu, 22 Aug 2024 00:08:00 -0500 Subject: [PATCH 3/8] Found a rogue }! --- 05-descriptive-analysis.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/05-descriptive-analysis.Rmd b/05-descriptive-analysis.Rmd index 3f69147..6604d9b 100644 --- a/05-descriptive-analysis.Rmd +++ b/05-descriptive-analysis.Rmd @@ -127,7 +127,7 @@ For the sake of simplicity, we've removed cases with missing values in the examp ## Counts and cross-tabulations -\index{Functions in srvyr!survey\_tally|(} \index{Functions in srvyr!survey\_count}|(} \index{survey\_tally|see {Functions in srvyr}} \index{Categorical data|(} \index{Cross-tabulation|(} \index{Measures of distribution|(} +\index{Functions in srvyr!survey\_tally|(} \index{Functions in srvyr!survey\_count|(} \index{survey\_tally|see {Functions in srvyr}} \index{Categorical data|(} \index{Cross-tabulation|(} \index{Measures of distribution|(} Using `survey_count()` and `survey_tally()`, we can calculate the estimated population counts for a given variable or combination of variables. These summaries, often referred to as cross-tabulations or cross-tabs, are applied to categorical data. They help in estimating counts of the population size for different groups based on the survey data. \index{Categorical data|)} From ad2e66cec002ccbcc80f6261ad7e3598dbb40001 Mon Sep 17 00:00:00 2001 From: Isabella Velasquez <ivelasq@gmail.com> Date: Thu, 22 Aug 2024 00:12:18 -0500 Subject: [PATCH 4/8] Edit srvyr set up --- 04-set-up.Rmd | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/04-set-up.Rmd b/04-set-up.Rmd index dd48d40..1954e86 100644 --- a/04-set-up.Rmd +++ b/04-set-up.Rmd @@ -21,16 +21,15 @@ This section provides details on the required packages and data, as well as the ### Packages {#setup-load-pkgs} -We use several packages throughout the book, but let's install and load specific ones for this chapter. Many functions in the examples and exercises are from three packages: {tidyverse}, {survey}, and {srvyr}. If they are not already installed, use the code below. The {tidyverse} and {survey} packages can both be installed from the Comprehensive R Archive Network (CRAN) [@lumley2010complex; @tidyverse2019]. We use the GitHub development version of {srvyr} because of its additional functionality compared to the one on CRAN [@R-srvyr]. Install the package directly from GitHub using the {remotes} package: +We use several packages throughout the book, but let's install and load specific ones for this chapter. Many functions in the examples and exercises are from three packages: {tidyverse}, {survey}, and {srvyr} [@tidyverse2019; @lumley2010complex; @R-srvyr]. The packages can be installed from the Comprehensive R Archive Network (CRAN) using the code below: ```{r} #| label: setup-install-core1 #| eval: FALSE -install.packages(c("tidyverse", "survey", "remotes")) -remotes::install_github("gergness/srvyr") +install.packages(c("tidyverse", "survey", "srvyr")) ``` -We bundled the datasets used in the book in an R package, {srvyrexploR}. Install it directly from GitHub using the {remotes} package: +We bundled the datasets used in the book in an R package, {srvyrexploR}. To install it from GitHub, configure your GitHub personal access token and use the {remotes} package: ```{r} #| label: setup-install-core2 From e7f010f60b061ba2af54acf8dd0f0aed5ac44f54 Mon Sep 17 00:00:00 2001 From: Stephanie Zimmer <stephaniezimmer@gmail.com> Date: Thu, 22 Aug 2024 08:48:11 -0400 Subject: [PATCH 5/8] Recommend using pak instead of remotes --- 01-introduction.Rmd | 2 +- 04-set-up.Rmd | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/01-introduction.Rmd b/01-introduction.Rmd index d0edfe7..de70ca3 100644 --- a/01-introduction.Rmd +++ b/01-introduction.Rmd @@ -181,7 +181,7 @@ packinfo_attach <- packinfo %>% packinfo_tib <- renv_pack %>% - filter(Package %in% c(pull(packinfo_attach, package), "remotes")) %>% + filter(Package %in% c(pull(packinfo_attach, package), "pak")) %>% rename(SourceInit=Source) %>% mutate( ShortSha=str_sub(RemoteSha, 1, 7), diff --git a/04-set-up.Rmd b/04-set-up.Rmd index 1954e86..c0afc19 100644 --- a/04-set-up.Rmd +++ b/04-set-up.Rmd @@ -29,13 +29,13 @@ We use several packages throughout the book, but let's install and load specific install.packages(c("tidyverse", "survey", "srvyr")) ``` -We bundled the datasets used in the book in an R package, {srvyrexploR}. To install it from GitHub, configure your GitHub personal access token and use the {remotes} package: +We bundled the datasets used in the book in an R package, {srvyrexploR}. To install it from GitHub, use the {pak} package: ```{r} #| label: setup-install-core2 #| eval: FALSE #| warning: FALSE -remotes::install_github("tidy-survey-r/srvyrexploR") +pak::pak("tidy-survey-r/srvyrexploR") ``` After installing these packages, load them using the `library()` function: From 9687983db65d601f69ea39a67071ccde1c0ec698 Mon Sep 17 00:00:00 2001 From: Stephanie Zimmer <stephaniezimmer@gmail.com> Date: Thu, 22 Aug 2024 11:34:41 -0400 Subject: [PATCH 6/8] Add ref to pak package --- 01-introduction.Rmd | 2 +- 04-set-up.Rmd | 2 +- 99-references.Rmd | 1 + renv.lock | 12 ++++++++++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/01-introduction.Rmd b/01-introduction.Rmd index de70ca3..cf2aa88 100644 --- a/01-introduction.Rmd +++ b/01-introduction.Rmd @@ -181,7 +181,7 @@ packinfo_attach <- packinfo %>% packinfo_tib <- renv_pack %>% - filter(Package %in% c(pull(packinfo_attach, package), "pak")) %>% + filter(Package %in% c(pull(packinfo_attach, package))) %>% rename(SourceInit=Source) %>% mutate( ShortSha=str_sub(RemoteSha, 1, 7), diff --git a/04-set-up.Rmd b/04-set-up.Rmd index c0afc19..2b2c30e 100644 --- a/04-set-up.Rmd +++ b/04-set-up.Rmd @@ -29,7 +29,7 @@ We use several packages throughout the book, but let's install and load specific install.packages(c("tidyverse", "survey", "srvyr")) ``` -We bundled the datasets used in the book in an R package, {srvyrexploR}. To install it from GitHub, use the {pak} package: +We bundled the datasets used in the book in an R package, {srvyrexploR} [@R-srvyrexploR]. To install it from GitHub, use the {pak} package [@R-pak]: ```{r} #| label: setup-install-core2 diff --git a/99-references.Rmd b/99-references.Rmd index 24760f0..7eef5f9 100644 --- a/99-references.Rmd +++ b/99-references.Rmd @@ -10,6 +10,7 @@ library(readxl) library(httr2) library(jsonlite) library(tidycensus) +library(pak) our_write_bib <- function (x = .packages(), file = "", tweak = TRUE, width = NULL, diff --git a/renv.lock b/renv.lock index 57aa729..4ede076 100644 --- a/renv.lock +++ b/renv.lock @@ -1581,6 +1581,18 @@ ], "Hash": "1f8c66528602fda4eef0c2e11eda5a57" }, + "pak": { + "Package": "pak", + "Version": "0.7.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "tools", + "utils" + ], + "Hash": "93288e19455e09f590b56db4d50248fe" + }, "pillar": { "Package": "pillar", "Version": "1.9.0", From 3e58442950be23acf7be437591a283418af23fca Mon Sep 17 00:00:00 2001 From: Isabella Velasquez <ivelasq@gmail.com> Date: Thu, 22 Aug 2024 07:12:53 -0500 Subject: [PATCH 7/8] add pak to installation step --- 04-set-up.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/04-set-up.Rmd b/04-set-up.Rmd index 2b2c30e..4feaf51 100644 --- a/04-set-up.Rmd +++ b/04-set-up.Rmd @@ -26,7 +26,7 @@ We use several packages throughout the book, but let's install and load specific ```{r} #| label: setup-install-core1 #| eval: FALSE -install.packages(c("tidyverse", "survey", "srvyr")) +install.packages(c("tidyverse", "pak", "survey", "srvyr")) ``` We bundled the datasets used in the book in an R package, {srvyrexploR} [@R-srvyrexploR]. To install it from GitHub, use the {pak} package [@R-pak]: From c8ecdf7d266bea1b06a58d5d870b5faa62dee28e Mon Sep 17 00:00:00 2001 From: Isabella Velasquez <ivelasq@gmail.com> Date: Thu, 22 Aug 2024 10:58:21 -0500 Subject: [PATCH 8/8] Move installation step to appropriate chunk --- 04-set-up.Rmd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/04-set-up.Rmd b/04-set-up.Rmd index 4feaf51..84bdeea 100644 --- a/04-set-up.Rmd +++ b/04-set-up.Rmd @@ -26,7 +26,7 @@ We use several packages throughout the book, but let's install and load specific ```{r} #| label: setup-install-core1 #| eval: FALSE -install.packages(c("tidyverse", "pak", "survey", "srvyr")) +install.packages(c("tidyverse", "survey", "srvyr")) ``` We bundled the datasets used in the book in an R package, {srvyrexploR} [@R-srvyrexploR]. To install it from GitHub, use the {pak} package [@R-pak]: @@ -35,6 +35,7 @@ We bundled the datasets used in the book in an R package, {srvyrexploR} [@R-srvy #| label: setup-install-core2 #| eval: FALSE #| warning: FALSE +install.packages("pak") pak::pak("tidy-survey-r/srvyrexploR") ```