Import data

import <- read.csv('https://raw.githubusercontent.com/Kingtilon1/DATA608/main/critical_minerals_and_import_source.csv')
producer <- read.csv('https://raw.githubusercontent.com/Kingtilon1/DATA608/main/producing_country_and_mineral.csv')
combined <- merge(import, producer, by = "Critical_Minerals")
combined$Production_Amount <- c(100000000, 60000, 28000, 2600000, 180, 16000, 18000000, 130000, 5700000, 540, 0, 850000, 530, 61000, 900000, 7200000, 1600000, 71000, 88, 140, 210000, 0, 860, 340, 95000, 150000, 71000, 70000, 0, 0, 500000)
combined$World_Production_Total <- c(380000000, 110000, 61000, 7900000, 280, 20000, 41000000, 190000, 8300000, 550, NA, 1300000, 900, 130000, 1000000, 20000000, 3300000, 79000, 210, 190, 300000, NA, 2000, 640, 310000, 260000, 84000, 100000, 0, 0, 1400000)

combined$Percent_of_World_Total <- combined$Production_Amount / combined$World_Production_Total

Add relationships to the data frame

relationships <- c("Neutral", "Neutral", "Neutral", "Competitors", "Neutral", "Neutral", "Neutral", "Neutral", "Competitors", "Neutral", 
                   "Neutral", "Neutral", "Competitors", "Neutral", "Neutral", "Neutral", "Competitors", "Neutral", "Neutral", "Neutral", 
                   "Neutral", "Competitors", "Neutral", "Competitors", "Competitors", "Competitors", "Neutral", "Competitors", "Neutral", 
                   "Competitors", "Neutral")

combined$relationship <- relationships
summary(combined[c("Primary_Import_Source", "Leading_Producing_Country")])
##  Primary_Import_Source Leading_Producing_Country
##  Length:31             Length:31                
##  Class :character      Class :character         
##  Mode  :character      Mode  :character
plot_ly(x = names(table(combined$Primary_Import_Source)), 
        y = table(combined$Primary_Import_Source),
        type = "bar",
        marker = list(color = "blue"),
        text = names(table(combined$Primary_Import_Source)),
        hoverinfo = "text+y",
        name = "Primary Import Sources") %>%
  layout(title = "Primary Import Sources",
         xaxis = list(title = "Country"),
         yaxis = list(title = "Frequency"))
plot_ly(x = names(table(combined$Leading_Producing_Country)), 
        y = table(combined$Leading_Producing_Country),
        type = "bar",
        marker = list(color = "green"),
        text = names(table(combined$Leading_Producing_Country)),
        hoverinfo = "text+y",
        name = "Leading Producing Countries") %>%
  layout(title = "Leading Producing Countries",
         xaxis = list(title = "Country"),
         yaxis = list(title = "Frequency"))

China and South Africa are the leading countries in producing critical minerals

summary(combined[c("Production_Amount", "World_Production_Total")])
##  Production_Amount   World_Production_Total
##  Min.   :        0   Min.   :        0     
##  1st Qu.:      435   1st Qu.:      900     
##  Median :    70000   Median :   110000     
##  Mean   :  4461764   Mean   : 16063751     
##  3rd Qu.:   675000   3rd Qu.:  1300000     
##  Max.   :100000000   Max.   :380000000     
##                      NA's   :2

In analyzing the production amounts in leading countries and the corresponding world production totals for critical minerals, we observe a diverse range of values. The summary statistics reveal that while the median production amount in leading countries is 70,000 units, the mean is substantially higher at approximately 4,461,764 units, indicating a right-skewed distribution potentially influenced by outliers. Notably, the maximum production amount recorded is 100,000,000 units, significantly surpassing the median and mean values, suggesting the presence of at least one extreme outlier. Similarly, for world production totals, the median is 110,000 units, while the mean stands at approximately 16,063,751 units, again pointing to a potential right-skewed distribution influenced by outliers. The maximum world production total recorded is 380,000,000 units, notably higher than the median and mean values. These findings underscore the importance of understanding the distribution and variability of production amounts and world production totals for critical minerals, as they are crucial for assessing source dependency and potential shortfall impact, aligning with the overarching task of developing a reference catalog of mineral sources and evaluating their reliability under various circumstances.

plot(combined$Production_Amount, combined$World_Production_Total, 
     xlab="Production Amount in Leading Country", ylab="World Production Total",
     main="Shortfall Impact: Production Amount vs. World Production Total",
     log="y")  
## Warning in xy.coords(x, y, xlabel, ylabel, log): 2 y values <= 0 omitted from
## logarithmic plot

The scatter plot titled “Shortfall Impact: Production Amount vs. World Production Total” visualizes the production amount of critical minerals in leading countries against the corresponding world production total. The majority of data points cluster towards the lower end of the production scale, indicating countries with relatively lower production amounts and world production totals. However, there are several outliers, particularly one prominent outlier located at the far right of the plot. This outlier represents a leading country with an exceptionally high production amount and world production total compared to others. Such outliers highlight the significant contribution of certain countries to the global production of critical minerals. Furthermore, the presence of outliers suggests potential vulnerabilities in the global supply chain, as disruptions in production from these key producers could have significant repercussions on the overall world production total. Therefore, the scatter plot underscores the importance of understanding and addressing source dependency and potential shortfall impact in ensuring a secure supply of critical minerals.

References

country relations countrys and their respective minerals