diff --git a/modules/Factors/lab/Factors_Lab.Rmd b/modules/Factors/lab/Factors_Lab.Rmd index 395c0545..5d301e82 100644 --- a/modules/Factors/lab/Factors_Lab.Rmd +++ b/modules/Factors/lab/Factors_Lab.Rmd @@ -5,19 +5,20 @@ editor_options: chunk_output_type: console --- -Load all the libraries we will use in this lab. +Load all the packages we will use in this lab. ```{r message=FALSE} -library(dplyr) -library(ggplot2) +library(tidyverse) ``` ### 1.0 -Load the Youth Tobacco Survey data (using the `jhur` library function `read_yts()`). `select` "Sample_Size", "Education", and "LocationAbbr". Name this data "yts". - -```{r 1.0response} +Load the Youth Tobacco Survey data and `select` "Sample_Size", "Education", and "LocationAbbr". Name this data "yts". +```{r} +yts <- + read_csv("https://daseh.org/data/Youth_Tobacco_Survey_YTS_Data.csv") %>% + select(Sample_Size, Education, LocationAbbr) ``` ### 1.1 diff --git a/modules/Factors/lab/Factors_Lab.html b/modules/Factors/lab/Factors_Lab.html index ee3f6e0a..aa5aedc5 100644 --- a/modules/Factors/lab/Factors_Lab.html +++ b/modules/Factors/lab/Factors_Lab.html @@ -353,15 +353,24 @@
Load all the libraries we will use in this lab.
-library(dplyr)
-library(ggplot2)
+Load all the packages we will use in this lab.
+library(tidyverse)
Load the Youth Tobacco Survey data (using the jhur
-library function read_yts()
). select
+
Load the Youth Tobacco Survey data and select
“Sample_Size”, “Education”, and “LocationAbbr”. Name this data
“yts”.
yts <-
+ read_csv("https://daseh.org/data/Youth_Tobacco_Survey_YTS_Data.csv") %>%
+ select(Sample_Size, Education, LocationAbbr)
+## Rows: 9794 Columns: 31
+## ── Column specification ────────────────────────────────────────────────────────
+## Delimiter: ","
+## chr (24): LocationAbbr, LocationDesc, TopicType, TopicDesc, MeasureDesc, Dat...
+## dbl (7): YEAR, Data_Value, Data_Value_Std_Err, Low_Confidence_Limit, High_C...
+##
+## ℹ Use `spec()` to retrieve the full column specification for this data.
+## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Load all the libraries we will use in this lab.
-library(dplyr)
-library(ggplot2)
+Load all the packages we will use in this lab.
+library(tidyverse)
Load the Youth Tobacco Survey data (using the jhur
-library function read_yts()
). select
+
Load the Youth Tobacco Survey data and select
“Sample_Size”, “Education”, and “LocationAbbr”. Name this data
“yts”.
library(jhur)
-yts <- read_yts() %>% select(Sample_Size, Education, LocationAbbr)
-# Alt:
-# yts <- read_csv("https://daseh.org/data/Youth_Tobacco_Survey_YTS_Data.csv")
+yts <-
+ read_csv("https://daseh.org/data/Youth_Tobacco_Survey_YTS_Data.csv") %>%
+ select(Sample_Size, Education, LocationAbbr)
+## Rows: 9794 Columns: 31
+## ── Column specification ────────────────────────────────────────────────────────
+## Delimiter: ","
+## chr (24): LocationAbbr, LocationDesc, TopicType, TopicDesc, MeasureDesc, Dat...
+## dbl (7): YEAR, Data_Value, Data_Value_Std_Err, Low_Confidence_Limit, High_C...
+##
+## ℹ Use `spec()` to retrieve the full column specification for this data.
+## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## Warning: Removed 425 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
-## Warning: Removed 425 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
-yts_fct %>%
count(Education)
## # A tibble: 2 × 2