Skip to content

Commit 168ffbf

Browse files
committed
Add to readme
1 parent d790454 commit 168ffbf

File tree

2 files changed

+128
-23
lines changed

2 files changed

+128
-23
lines changed

README.Rmd

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ knitr::opts_chunk$set(
2020
fig.align = 'center',
2121
tidy = 'styler'
2222
)
23-
library(tidyverse)
2423
```
2524

2625
The **srvyexploR** package provides datasets used in the book [Exploring Complex Survey Data Analysis Using R: A Tidy Introduction with {srvyr} and {survey}](https://tidy-survey-r.github.io/tidy-survey-book/). This will help readers follow along with the examples and work through the exercises.
@@ -77,6 +76,16 @@ head(ncvs_2021_person)
7776
head(ncvs_2021_incident)
7877
```
7978

79+
### NSDUH
80+
81+
The National Survey on Drug Use and Health (NSDUH) is an annual survey of the civilian, non-institutionalized population in the United States who are at least 12 years old. Topics include substance use (tobacco, alcohol, and illicit drugs including marijuana), mental health, and general health. This package provides a subset of the variables from the 2023 Public Use File. For more details about the study and the data, refer to the [Methodological Summary and Definitions](https://www.samhsa.gov/data/sites/default/files/reports/rpt47098/Methodological%20Summary%20and%20Definitions/2023-nsduh-method-summary-defs.pdf), [Data User's Guide](https://www.samhsa.gov/data/sites/default/files/reports/rpt56198/2023-nsduh-puf-data-users-guide.pdf), and [Codebook](https://www.samhsa.gov/data/system/files/media-puf-file/NSDUH-2023-DS0001-info-codebook_v1.pdf).
82+
83+
```{r}
84+
#| label: nsduh-show
85+
86+
head(nsduh_2023)
87+
```
88+
8089
### RECS
8190

8291
Three files are included associated with RECS - a dataset with the 2015 data with some derived variables created for the book (`recs_2015`), the 2020 data with some derived variables created for the book (`recs_2020`), and the 2020 data with the original variables (`recs_2020_raw`). RECS is a survey about energy consumption and expenditure among residential households in the United States and has been conducted since 1979 by the Energy Information Administration. More information about the original data is available at the [RECS website](https://www.eia.gov/consumption/residential/data/2020/).
@@ -137,13 +146,18 @@ Anyone interested in redistributing the ANES data should refer to the [ANES FAQ
137146

138147
ANES:
139148

140-
+ American National Election Studies. 2021. ANES 2020 Time Series Study Full Release [dataset and documentation]. July 19, 2021 version. https://www.electionstudies.org
149+
+ American National Election Studies, 2021. ANES 2020 Time Series Study Full Release [dataset and documentation]. July 19, 2021 version. https://www.electionstudies.org
141150

142151
NCVS:
143152

144153
+ United States. Bureau of Justice Statistics. National Crime Victimization Survey, [United States], 2021. Inter-university Consortium for Political and Social Research [distributor], 2022-09-19. https://doi.org/10.3886/ICPSR38429.v1
145154

155+
NSDUH:
156+
157+
+ Center for Behavioral Health Statistics and Quality, 2025. 2023 National Survey on Drug Use
158+
and Health: Public use file data users’ guide. https://www.samhsa.gov/data/data-wecollect/nsduh/datafiles
159+
146160
RECS:
147161

148-
+ U.S. Energy Information Administration. 2024. Residential Energy Consumption 2020 Survey Data. [dataset and documentation]. January 2024 version. https://www.eia.gov/consumption/residential/data/2020/index.php?view=microdata
149-
+ U.S. Energy Information Administration. 2018 Residential Energy Consumption 2015 Survey Data. [dataset and documentation]. December 2018 version. https://www.eia.gov/consumption/residential/data/2015/index.php?view=microdata
162+
+ U.S. Energy Information Administration, 2024. Residential Energy Consumption 2020 Survey Data. [dataset and documentation]. January 2024 version. https://www.eia.gov/consumption/residential/data/2020/index.php?view=microdata
163+
+ U.S. Energy Information Administration, 2018 Residential Energy Consumption 2015 Survey Data. [dataset and documentation]. December 2018 version. https://www.eia.gov/consumption/residential/data/2015/index.php?view=microdata

README.md

Lines changed: 110 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,76 @@ Once the package is loaded, you can use the data immediately as follows:
4747

4848
``` r
4949
head(anes_2020)
50-
#> # A tibble: 6 × 65
51-
#> V200001 CaseID V200002 InterviewMode V200010b Weight V200010c VarUnit V200010d
52-
#> <dbl> <dbl> <hvn_l> <fct> <dbl> <dbl> <dbl> <fct> <dbl>
53-
#> 1 200015 200015 3 Web 1.01 1.01 2 2 9
54-
#> 2 200022 200022 3 Web 1.16 1.16 2 2 26
55-
#> 3 200039 200039 3 Web 0.769 0.769 1 1 41
56-
#> 4 200046 200046 3 Web 0.521 0.521 2 2 29
57-
#> 5 200053 200053 3 Web 0.966 0.966 1 1 23
58-
#> 6 200060 200060 3 Web 0.235 0.235 2 2 37
59-
#> # ℹ 56 more variables: Stratum <fct>, V201006 <hvn_lbll>,
60-
#> # CampaignInterest <fct>, V201023 <hvn_lbll>, EarlyVote2020 <fct>,
61-
#> # V201024 <hvn_lbll>, V201025x <hvn_lbll>, V201028 <hvn_lbll>,
62-
#> # V201029 <hvn_lbll>, V201101 <hvn_lbll>, V201102 <hvn_lbll>,
63-
#> # VotedPres2016 <fct>, V201103 <hvn_lbll>, VotedPres2016_selection <fct>,
64-
#> # V201228 <hvn_lbll>, V201229 <hvn_lbll>, V201230 <hvn_lbll>,
65-
#> # V201231x <hvn_lbll>, PartyID <fct>, V201233 <hvn_lbll>, …
50+
#> V200001 CaseID V200002 InterviewMode V200010b Weight V200010c VarUnit
51+
#> 1 200015 200015 3 Web 1.0057375 1.0057375 2 2
52+
#> 2 200022 200022 3 Web 1.1634731 1.1634731 2 2
53+
#> 3 200039 200039 3 Web 0.7686811 0.7686811 1 1
54+
#> 4 200046 200046 3 Web 0.5210195 0.5210195 2 2
55+
#> 5 200053 200053 3 Web 0.9657892 0.9657892 1 1
56+
#> 6 200060 200060 3 Web 0.2347078 0.2347078 2 2
57+
#> V200010d Stratum V201006 CampaignInterest V201023 EarlyVote2020 V201024
58+
#> 1 9 9 2 Somewhat interested -1 <NA> -1
59+
#> 2 26 26 3 Not much interested -1 <NA> -1
60+
#> 3 41 41 2 Somewhat interested -1 <NA> -1
61+
#> 4 29 29 3 Not much interested -1 <NA> -1
62+
#> 5 23 23 2 Somewhat interested -1 <NA> -1
63+
#> 6 37 37 1 Very much interested -1 <NA> -1
64+
#> V201025x V201028 V201029 V201101 V201102 VotedPres2016 V201103
65+
#> 1 3 -1 -1 -1 1 Yes 2
66+
#> 2 3 -1 -1 -1 1 Yes 5
67+
#> 3 3 -1 -1 -1 1 Yes 1
68+
#> 4 3 -1 -1 -1 1 Yes 1
69+
#> 5 3 -1 -1 -1 1 Yes 2
70+
#> 6 3 -1 -1 -1 2 No -1
71+
#> VotedPres2016_selection V201228 V201229 V201230 V201231x
72+
#> 1 Trump 2 1 -1 7
73+
#> 2 Other 5 -1 2 4
74+
#> 3 Clinton 3 -1 3 3
75+
#> 4 Clinton 2 2 -1 6
76+
#> 5 Trump 3 -1 2 4
77+
#> 6 <NA> 3 -1 3 3
78+
#> PartyID V201233 TrustGovernment V201237
79+
#> 1 Strong republican 5 Never 3
80+
#> 2 Independent 5 Never 4
81+
#> 3 Independent-democrat 4 Some of the time 4
82+
#> 4 Not very strong republican 3 About half the time 2
83+
#> 5 Independent 5 Never 4
84+
#> 6 Independent-democrat 4 Some of the time 2
85+
#> TrustPeople V201507x Age AgeGroup V201510 Education V201546
86+
#> 1 About half the time 46 46 40-49 6 Bachelor's 1
87+
#> 2 Some of the time 37 37 30-39 3 Post HS 2
88+
#> 3 Some of the time 40 40 40-49 2 High school 2
89+
#> 4 Most of the time 41 41 40-49 4 Post HS 2
90+
#> 5 Some of the time 72 72 70 or older 8 Graduate 2
91+
#> 6 Most of the time 71 71 70 or older 3 Post HS 2
92+
#> V201547a V201547b V201547c V201547d V201547e V201547z V201549x RaceEth
93+
#> 1 -3 -3 -3 -3 -3 -3 3 Hispanic
94+
#> 2 -3 -3 -3 -3 -3 -3 4 Asian, NH/PI
95+
#> 3 -3 -3 -3 -3 -3 -3 1 White
96+
#> 4 -3 -3 -3 -3 -3 -3 4 Asian, NH/PI
97+
#> 5 -3 -3 -3 -3 -3 -3 5 AI/AN
98+
#> 6 -3 -3 -3 -3 -3 -3 1 White
99+
#> V201600 Gender V201607 V201610 V201611 V201613 V201615 V201616 V201617x
100+
#> 1 1 Male -3 -3 -3 -3 -3 -3 21
101+
#> 2 2 Female -3 -3 -3 -3 -3 -3 13
102+
#> 3 2 Female -3 -3 -3 -3 -3 -3 17
103+
#> 4 1 Male -3 -3 -3 -3 -3 -3 7
104+
#> 5 1 Male -3 -3 -3 -3 -3 -3 22
105+
#> 6 2 Female -3 -3 -3 -3 -3 -3 3
106+
#> Income Income7 V202051 V202066 V202072 VotedPres2020
107+
#> 1 $175,000-249,999 $125k or more -1 1 -1 <NA>
108+
#> 2 $70,000-74,999 $60k to < 80k -1 4 1 Yes
109+
#> 3 $100,000-109,999 $100k to < 125k -1 4 1 Yes
110+
#> 4 $35,000-39,999 $20k to < 40k -1 4 1 Yes
111+
#> 5 $250,000 or more $125k or more -1 4 1 Yes
112+
#> 6 $15,000-19,999 Under $20k -1 4 1 Yes
113+
#> V202073 V202109x V202110x VotedPres2020_selection
114+
#> 1 -1 0 -1 <NA>
115+
#> 2 3 1 3 Other
116+
#> 3 1 1 1 Biden
117+
#> 4 1 1 1 Biden
118+
#> 5 2 1 2 Trump
119+
#> 6 1 1 1 Biden
66120
```
67121

68122
See `?anes_2020` for more information about the data.
@@ -129,6 +183,37 @@ head(ncvs_2021_incident)
129183
#> # V4267 <fct>, V4268 <fct>, V4269 <fct>, V4270 <fct>, V4271 <fct>, …
130184
```
131185

186+
### NSDUH
187+
188+
The National Survey on Drug Use and Health (NSDUH) is an annual survey
189+
of the civilian, non-institutionalized population in the United States
190+
who are at least 12 years old. Topics include substance use (tobacco,
191+
alcohol, and illicit drugs including marijuana), mental health, and
192+
general health. This package provides a subset of the variables from the
193+
2023 Public Use File. For more details about the study and the data,
194+
refer to the [Methodological Summary and
195+
Definitions](https://www.samhsa.gov/data/sites/default/files/reports/rpt47098/Methodological%20Summary%20and%20Definitions/2023-nsduh-method-summary-defs.pdf),
196+
[Data User’s
197+
Guide](https://www.samhsa.gov/data/sites/default/files/reports/rpt56198/2023-nsduh-puf-data-users-guide.pdf),
198+
and
199+
[Codebook](https://www.samhsa.gov/data/system/files/media-puf-file/NSDUH-2023-DS0001-info-codebook_v1.pdf).
200+
201+
``` r
202+
head(nsduh_2023)
203+
#> # A tibble: 6 × 22
204+
#> QUESTID2 ANALWT2_C VESTR_C VEREP NICVAPMON TOBMON ALCMON ILLMON ILTOBVAPALC
205+
#> <dbl> <dbl> <dbl> <dbl> <int> <int> <int> <int> <int>
206+
#> 1 10000053 3276. 40031 2 0 0 1 0 1
207+
#> 2 10000679 15630. 40021 2 0 1 1 0 1
208+
#> 3 10001208 4018. 40043 1 0 1 0 1 1
209+
#> 4 10001260 10712. 40030 2 0 0 0 0 0
210+
#> 5 10001588 8195. 40023 2 0 0 1 0 1
211+
#> 6 10004996 3771. 40048 1 1 1 1 0 1
212+
#> # ℹ 13 more variables: BNGDRKMON <int>, IRPYUD5ALC <int>, UD5ILLANY <int>,
213+
#> # UD5ILALANY <int>, YMDELT <fct>, YMDEYR <fct>, MDEIMPY <fct>, AMIPY <int>,
214+
#> # SMIPY <int>, AGE3 <fct>, NEWRACE2 <fct>, IRSEX <fct>, POVERTY3 <fct>
215+
```
216+
132217
### RECS
133218

134219
Three files are included associated with RECS - a dataset with the 2015
@@ -273,7 +358,7 @@ Anyone interested in redistributing the ANES data should refer to the
273358

274359
ANES:
275360

276-
- American National Election Studies. 2021. ANES 2020 Time Series Study
361+
- American National Election Studies, 2021. ANES 2020 Time Series Study
277362
Full Release \[dataset and documentation\]. July 19, 2021 version.
278363
<https://www.electionstudies.org>
279364

@@ -284,13 +369,19 @@ NCVS:
284369
Consortium for Political and Social Research \[distributor\],
285370
2022-09-19. <https://doi.org/10.3886/ICPSR38429.v1>
286371

372+
NSDUH:
373+
374+
- Center for Behavioral Health Statistics and Quality, 2025. 2023
375+
National Survey on Drug Use and Health: Public use file data users’
376+
guide. <https://www.samhsa.gov/data/data-wecollect/nsduh/datafiles>
377+
287378
RECS:
288379

289-
- U.S. Energy Information Administration. 2024. Residential Energy
380+
- U.S. Energy Information Administration, 2024. Residential Energy
290381
Consumption 2020 Survey Data. \[dataset and documentation\]. January
291382
2024 version.
292383
<https://www.eia.gov/consumption/residential/data/2020/index.php?view=microdata>
293-
- U.S. Energy Information Administration. 2018 Residential Energy
384+
- U.S. Energy Information Administration, 2018 Residential Energy
294385
Consumption 2015 Survey Data. \[dataset and documentation\]. December
295386
2018 version.
296387
<https://www.eia.gov/consumption/residential/data/2015/index.php?view=microdata>

0 commit comments

Comments
 (0)