library(ggplot2)
library(readr)

Dataset <- read.csv("C:/Users/HP/OneDrive/Desktop/intro to R/APEX Historical Data.csv", stringsAsFactors = TRUE)

Dataset$Date <- as.Date(Dataset$Date, format = "%m/%d/%Y")  
date_seq <- seq(min(Dataset$Date), max(Dataset$Date), by = "day")

interpolated_prices <- approx(Dataset$Date, Dataset$Price, xout = date_seq)$y

interpolated_data <- data.frame(Date = date_seq, Price = interpolated_prices)

ggplot(interpolated_data, aes(x = Date, y = Price)) +
  geom_line(color = "darkblue", linewidth = 1.2, linetype = "solid") +
  labs(title = "Stock Price Over Time", x = "Date", y = "Price") +
  theme_minimal() +  
  theme(plot.title = element_text(size = 18, face = "bold", color = "darkblue"),  
        axis.title.x = element_text(size = 14, color = "darkblue"),  
        axis.title.y = element_text(size = 14, color = "darkblue"),  
        axis.text.x = element_text(size = 12),  
        axis.text.y = element_text(size = 12))  

Graph Overview: The x-axis shows the timeline from 2018 to 2024. The y-axis represents the price, although it’s not explicitly labeled. The blue line graph depicts fluctuations in the company’s stock price. Around mid-2018, there was a drop in the price. Another drop occurred around mid-2020. However, from late 2020 to 2024, the price significantly increased, reaching a peak. The rising trend suggests that Apex Footwear LTD experienced growth during this period.

library(ggplot2)
library(readr)
library(gganimate)
Dataset <- read.csv("C:/Users/HP/OneDrive/Desktop/intro to R/APEX Historical Data.csv", stringsAsFactors = TRUE)
Dataset$Date <- as.Date(Dataset$Date, format = "%m/%d/%Y")
date_seq <- seq(min(Dataset$Date), max(Dataset$Date), by = "day")
interpolated_prices <- approx(Dataset$Date, Dataset$Price, xout = date_seq)$y
interpolated_data <- data.frame(Date = date_seq, Price = interpolated_prices)

p <- ggplot(interpolated_data, aes(x = Date, y = Price)) +
  geom_line(color = "red", size = 1.2, linetype = "solid") +
  labs(title = "Stock Price Over Time", x = "Date", y = "Price") +
  theme_minimal() +
  theme(plot.title = element_text(size = 18, face = "bold", color = "darkblue"),
        axis.title.x = element_text(size = 14, color = "darkblue"),
        axis.title.y = element_text(size = 14, color = "darkblue"),
        axis.text.x = element_text(size = 12),
        axis.text.y = element_text(size = 12))

animate(p + transition_reveal(Date), nframes = 100, fps = 10, end_pause = 20)

Graph Overview: The animated animation above shows Apex Footwear LTD. stock price from 2018 until 2024. Watch as the fluctuations occur, providing a visually appealing journey through the market’s highs and lows.

library(ggplot2)
library(plotly)
library(hrbrthemes)
library(readr)

Dataset <- read.csv("C:/Users/HP/OneDrive/Desktop/intro to R/female-employment-and-microfinance-in-bangladesh.csv", stringsAsFactors = TRUE)

Dataset$PerFemEmploy <- round(Dataset$PerFemEmploy)
Dataset$Ratio_MaletoFemale <- round(Dataset$Ratio_MaletoFemale)

p <- ggplot(Dataset, aes(x = Ratio_MaletoFemale, y = PerFemEmploy, size = Agriculture, color = Services, text = Industry)) +
  geom_point(alpha = 0.5) +
  scale_size_continuous(range = c(1.4, 19), name = "Agriculture") +  
  scale_color_continuous(guide = FALSE) +  
  theme_ipsum() +
  theme(legend.position = "none")

pp <- ggplotly(p)
pp

Graph Overview: The graph displays a bubble chart representing the ratio of male to female in different sectors like agriculture and Services. Sectors are likely represented by the bubbles, and their size indicate the number of observations or another relevant variable.When everything goes up, the size and color of the double changes.

library(ggplot2)
library(dplyr)

Dataset <- read.csv("C:/Users/HP/OneDrive/Desktop/intro to R/female-employment-and-microfinance-in-bangladesh.csv", stringsAsFactors = TRUE)

Dataset$PerFemEmploy <- round(Dataset$PerFemEmploy)

ggplot(Dataset, aes(x = Year)) +
  geom_bar(aes(y = PerFemEmploy, fill = "PerFemEmploy"), stat = "identity", position = "dodge") +
  geom_bar(aes(y = Industry, fill = "Industry"), stat = "identity", position = "dodge") +
  scale_fill_manual(values = c("PerFemEmploy" = "skyblue", "Industry" = "blue")) +
  labs(title = "Female Employment vs Industry",
       x = "Year",
       y = "Value") +
  theme_minimal() +
  theme(legend.title = element_blank())

Graph Overview: The vertical bars represent data values for different years of how Female empowerment increases with Industry increase.

library(ggplot2)

Dataset <- read.csv("C:/Users/HP/OneDrive/Desktop/intro to R/female-employment-and-microfinance-in-bangladesh.csv", stringsAsFactors = TRUE)

Dataset$PerFemEmploy <- round(Dataset$PerFemEmploy)

ggplot(Dataset, aes(x = Year, y = PerFemEmploy)) +
  geom_density_2d(color = "darkblue", fill = "pink", alpha = 0.6) + 
  labs(title = "2D Density Plot of PerFemEmploy and Year",
       x = "Year",
       y = "PerFemEmploy")

The plot displays contours, which represent areas of similar density. The x-axis likely corresponds to the Year, while the y-axis represents the PerfGenEmploy values. The contour lines indicate where data points are more densely concentrated.

library(ggplot2)
library(gganimate)

Dataset <- read.csv("C:/Users/HP/OneDrive/Desktop/intro to R/female-employment-and-microfinance-in-bangladesh.csv", stringsAsFactors = TRUE)

Dataset$PerFemEmploy <- round(Dataset$PerFemEmploy)

p <- ggplot(Dataset, aes(x = Year, y = PerFemEmploy)) +
  geom_point(aes(size = Industry, color = Agriculture), alpha = 0.7) +
  scale_size_continuous(range = c(1, 10), name = "Industry") +
  scale_color_continuous(name = "Agriculture") +
  labs(title = "PerFemEmploy by Year",
       x = "Year",
       y = "PerFemEmploy") +
  theme_minimal()

p + transition_states(Year, transition_length = 2, state_length = 1)

Graph Overview: This animated graph shows that Agriculture and industry are growing along with female empowerment.

library(tidyquant)
library(tidyverse)

my_price_df <- tq_get(c('GOOGL', 'MSFT', 'AMZN'),
                      from = "2020-01-01",
                      get = "stock.prices")

my_ret_df <- my_price_df %>%
  group_by(symbol) %>%
  tq_transmute(select = adjusted,
               mutate_fun = periodReturn,
               period = "monthly",
               col_rename = 'ret') %>%
  mutate(ret = if_else(row_number() == 1, 0, ret)) %>%
  mutate(cr = cumprod(1 + ret) - 1)

library(gganimate)

p <- my_ret_df %>%
  ggplot(aes(x = date, y = cr, color = symbol, group = symbol)) +
  geom_line() +
  geom_segment(aes(xend = ymd("2023-05-17"), yend = cr), linetype = 2, colour = 'blue') + 
  geom_point(size = 2) + 
  geom_text(aes(x = ymd("2023-05-18"), label = symbol), hjust = 0) +
  scale_y_continuous(breaks = seq(-0.35,1, 0.1),
                     labels = scales::percent) +
  transition_reveal(date) +
  coord_cartesian(clip = 'off') + 
  labs(title = 'Index Returns', x = "Year", y = 'Returns (%)') + 
  theme_minimal()

animate(p, nframe = 200, end_pause = 20)

Graph Overview: The graph visually depicts how the stock prices of Amazon, GOOGLE, and Microsoft have evolved over time. Observations can be made regarding trends and volatility.