1 Loading the data
This week’s tidy Tuesday data set for 2023-02-07 is concerned with tech company stock prices. Let’s load the data:
The data gives us an overview of the symbols for a few tech companies:
Show the code
big_tech_companies# A tibble: 14 × 2
stock_symbol company
<chr> <chr>
1 AAPL Apple Inc.
2 ADBE Adobe Inc.
3 AMZN Amazon.com, Inc.
4 CRM Salesforce, Inc.
5 CSCO Cisco Systems, Inc.
6 GOOGL Alphabet Inc.
7 IBM International Business Machines Corporation
8 INTC Intel Corporation
9 META Meta Platforms, Inc.
10 MSFT Microsoft Corporation
11 NFLX Netflix, Inc.
12 NVDA NVIDIA Corporation
13 ORCL Oracle Corporation
14 TSLA Tesla, Inc.
Although there was corresponding open and closing data for this week’s data, we will take a slightly different approach and will integrate different packages to retrieve that information. Let’s focus on Netflix Inc., NVIDIA Corporation, and Salesforce Inc.. We can get the stock information for these companies by specifying their symbol, when using the getSymbols() function from the quantmod package:
Show the code
NVIDIA <- getSymbols("NVDA", auto.assign = FALSE)
NETFLIX <- getSymbols("NFLX", auto.assign = FALSE)
SALESFORCE <- getSymbols("CRM", auto.assign = FALSE)If you are curious as to how this data may look like, you can call one of the objects:
NFLX.Open NFLX.High NFLX.Low NFLX.Close NFLX.Volume NFLX.Adjusted
2007-01-03 3.714286 3.824286 3.677143 3.801429 16440900 3.801429
2007-01-04 3.772857 3.828571 3.585714 3.621429 15959300 3.621429
2007-01-05 3.620000 3.620000 3.492857 3.544286 15190700 3.544286
2007-01-08 3.545714 3.555714 3.367143 3.404286 18344900 3.404286
2 Data Visualisation
Now that we have our data, we can proceed to visualise it. We will use the highcharter package, which has some built in functionality, let’s use open-high-low-close chart for the Netflix and Salesforce stocks, for the NVIDIA stocks let’s use a candlestick plot:
Show the code
highchart(type = "stock") |>
hc_add_series(NVIDIA) |>
hc_add_series(NETFLIX, type = "ohlc") %>%
hc_add_series(SALESFORCE, type = "ohlc") %>%
hc_add_theme(hc_theme_monokai())The widget offers some interactive elements, play around with it to understand more about the stock prices of the companies over time!
Show the code
1 + 1