Apple Stock Analysis

Ayesha Ansari

2026-06-11

OVERVIEW

This project analyzes the historical performance of Apple Inc. (AAPL) stock using data obtained from Yahoo Finance through the R programming language. The analysis focuses on two key aspects of stock performance: historical closing prices and daily returns.

The historical stock price visualization helps identify long-term trends and overall growth in Apple’s market value, while the daily returns analysis highlights short-term fluctuations and volatility in stock performance. Interactive charts created using Plotly allow users to explore the data in greater detail through zooming and hovering features.

The objective of this analysis is to gain insights into Apple’s stock behavior over time and understand both its long-term price movement and day-to-day return patterns.

HISTORICAL STOCK PRICES

invisible(getSymbols("AAPL", auto.assign = TRUE))

stock_data <- data.frame(
  Date  = index(AAPL),
  Close = as.numeric(Cl(AAPL))
)

plot_ly(
  stock_data,
  x    = ~Date,
  y    = ~Close,
  type = "scatter",
  mode = "lines",
  line = list(color = "#007AFF"),
  name = "AAPL Close"
) %>%
  layout(
    title  = "Apple Closing Price Over Time",
    xaxis  = list(title = "Date"),
    yaxis  = list(title = "Price (USD)"),
    hovermode = "x unified"
  )

DAILY RETURNS

aapl_returns <- dailyReturn(AAPL)

returns_df <- data.frame(
  Date = index(aapl_returns),
  Return = as.numeric(aapl_returns[,1])
)

plot_ly(
  returns_df,
  x = ~Date,
  y = ~Return,
  type = "scatter",
  mode = "lines"
) %>%
layout(
  title = "Daily Returns of Apple Stock",
  yaxis = list(title = "Daily Return"),
  hovermode = "x unified"
)

CONCLUSION

The analysis of Apple Inc. (AAPL) stock data provides valuable insights into its historical market performance. The historical stock price chart demonstrates the overall trend and growth of Apple’s stock over time, reflecting its strong market presence and investor confidence.

The daily returns chart reveals the fluctuations in stock performance on a day-to-day basis, highlighting periods of higher and lower volatility. By examining both historical prices and daily returns, investors and analysts can better understand the stock’s long-term trajectory as well as its short-term market behavior.

Overall, this analysis demonstrates how financial data can be effectively visualized and explored using R and Plotly to support informed investment and market analysis.

Thankyou!