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
Loading the data to use
tobacco_raw<-read_csv("adult_tobacco_consumption_2000_present_cdc.csv")
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.

Cleaning Up Data

tobacco_summary<- tobacco_raw|>
  group_by(Submeasure)|>
  summarize(
    total_domestic=sum(Domestic,na.rm=TRUE),
    total_imports=sum(Imports,na.rm=TRUE)
  )|>
  arrange(desc(total_imports))
tobacco_summary
# A tibble: 10 × 3
   Submeasure                total_domestic total_imports
   <chr>                              <dbl>         <dbl>
 1 Total Combustible Tobacco  7541000000000  420969067951
 2 Cigarette Removals         7047000000000  277956054000
 3 Total Cigars                168555364875  104909335615
 4 Large Cigars                130555597645  102038183615
 5 Total Loose Tobacco         325658002873   38181076433
 6 Pipe Tobacco                239393398791   29899380183
 7 Roll-Your-Own Tobacco        86264612067    8281696252
 8 Small Cigars                 37999761230    2871152000
 9 Snuff                         2353285439      13609871
10 Chewing Tobacco                667218157      12536242

Creating Final visualization
ggplot(data=tobacco_summary,aes(x=total_imports,y=Submeasure,fill=Submeasure))+
  geom_col()+
  theme_minimal()+
  labs(
    title= "Total Tobacco Product Imports",
    x= "Total Product Imported ",
    y= "Tobacco Product Category",
    fill= "Product Category",
    caption= "Data from CDC"
  )


Reflection

  1. 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.

  2. 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.

  3. 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.