Skip to content

Commit

Permalink
Merge pull request #169 from tidy-survey-r/update-srvyr-130
Browse files Browse the repository at this point in the history
Update srvyr to 1.3.0 and update book description
  • Loading branch information
ivelasq authored Aug 22, 2024
2 parents 2ba717b + c8ecdf7 commit 27a43d4
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion 01-introduction.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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))) %>%
rename(SourceInit=Source) %>%
mutate(
ShortSha=str_sub(RemoteSha, 1, 7),
Expand Down
13 changes: 6 additions & 7 deletions 04-set-up.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ 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} [@R-srvyrexploR]. To install it from GitHub, use the {pak} package [@R-pak]:

```{r}
#| label: setup-install-core2
#| eval: FALSE
#| warning: FALSE
remotes::install_github("tidy-survey-r/srvyrexploR")
install.packages("pak")
pak::pak("tidy-survey-r/srvyrexploR")
```

After installing these packages, load them using the `library()` function:
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion 05-descriptive-analysis.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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|)}

Expand Down
1 change: 1 addition & 0 deletions 99-references.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 16 additions & 10 deletions renv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -2051,16 +2063,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",
Expand All @@ -2071,7 +2077,7 @@
"tidyselect",
"vctrs"
],
"Hash": "c77ebba142d814788bab0092bf102f6d"
"Hash": "11179f4e74e0018168ae9f219809a3f2"
},
"srvyrexploR": {
"Package": "srvyrexploR",
Expand Down

0 comments on commit 27a43d4

Please sign in to comment.