Project Part 1

Preparing the hours spent with digital media data for plotting.

  1. I downloaded hours spent with digital media data from Our World in Data. I selected this data because I’m interested in the daily hours spent with digital media from 2008 through 2018.

  2. This is the link to the data.

3, The following code chunk loads the package I will use to read in and prepare the data for analysis.

  1. Read the data in
daily_hours_spent_with_digital_media_per_adult_user <- 
read_csv(here::here("_posts/2022-05-10-project-part-1/daily-hours-spent-with-digital-media-per-adult-user.csv"))
  1. Use glimpse to see the names and types of the columns
glimpse(daily_hours_spent_with_digital_media_per_adult_user)
Rows: 11
Columns: 6
$ Entity                                                  <chr> "Uni~
$ Code                                                    <chr> "USA~
$ Year                                                    <dbl> 2008~
$ `Mobile (BOND Internet Trends (2019))`                  <dbl> 0.3,~
$ `Desktop/Laptop (BOND Internet Trends (2019))`          <dbl> 2.2,~
$ `Other Connected Devices (BOND Internet Trends (2019))` <dbl> 0.2,~
View(daily_hours_spent_with_digital_media_per_adult_user)
  1. Use output from glimpse (and View) to prepare the data for analysis
digital_media <- c("Mobile",
                   "Desktop/Laptop",
                   "Other Connected Devices")

daily_hours_spent <- daily_hours_spent_with_digital_media_per_adult_user %>% 
  rename(Digital_Media = 1, Mobile = 4, Desktop_Laptop = 5, Other_Connected_Devices = 6) %>%
  filter(Year >= 2008, Digital_Media %in% digital_media) %>%
  select(Digital_Media, Year, Mobile, Desktop_Laptop, Other_Connected_Devices)

daily_hours_spent
# A tibble: 0 x 5
# ... with 5 variables: Digital_Media <chr>, Year <dbl>,
#   Mobile <dbl>, Desktop_Laptop <dbl>, Other_Connected_Devices <dbl>

Add a picture.

daily hours spent with digital media

Write the data to file in the project directory

write_csv(daily_hours_spent, file="daily_hours_spent.csv")