DATA110 Project 1: US Domestic vs Imported Tobacco Analysis
Author
Bohlale Mosotho
Dataset Overview This dataset contains various tobacco products accross the United States from 2000 to 2023. Variables such as domestic, imports, topic, submeasure, measure and many others. It describes how many tobacco products are sold domestically, imported from other countries, what kind of tobacco product it is and if the numbers show any preference, in particular, it covers data from 2000 to 2023 which can reveal popularity of tobacco products and how much of the population actually consumes it.
In this project, I have decided to focus on market analysis of tobacco products manufactured and sold in the US against the imported tobacco products from foreign markets. My interest in this topic is because I am a business analytics major at Montgomery College. In particular, I am investigating which tobacco product categories are dependent on imports or domestic production.
The original data set is from the class course resources, to be more precise it is from the Center for Disease Control website and is available to the public.
Importing the data package
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.2.1 ✔ readr 2.2.0
✔ forcats 1.0.1 ✔ stringr 1.6.0
✔ ggplot2 4.0.3 ✔ tibble 3.3.1
✔ lubridate 1.9.5 ✔ tidyr 1.3.2
✔ purrr 1.2.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Rows: 312 Columns: 14
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (6): LocationAbbrev, LocationDesc, Topic, Measure, Submeasure, Data Valu...
dbl (8): Year, Population, Domestic, Imports, Total, Domestic Per Capita, Im...
ℹ 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.
I cleaned and worked on the data set by first imported the data set using read_csv(), follwed by applying a group_by() to categorize the particular data i wanted to use about imports and domestic tobacco products. I followed up by the function summarize() to calculate the total consumption of tobacco products domestic vs imported and finally used a trick from YouTube to arrange the summary from highest to lowest values.
I used a geom_col which is type of bar chart to display total imported across different tobacco products. The interesting pattern is the most used tobacco product was total combustible tobacco indicating that despite the different years and possible new tobacco products, not many have left the traditonal tobacco products.
It would have been more prefereable to make a steamgraph to show the growth or fall of tobacco products over the years, however, to many variables to consider and it would make it hard to read let alone code it.