EDA in practice
In this section, we will analyze a dataset that consists of the stock prices of the top five companies in 2021. First, we will look at how to download and process these stock indexes, followed by performing univariate analysis and bivariate analysis in terms of correlation.
Obtaining the stock price data
To obtain the daily stock prices of a particular ticker, we can use the yfR
package to download the data from Yahoo! Finance, a vast repository of financial data that covers a large number of markets and assets and has been widely used in both academia and industry. The following exercise illustrates how to download the stock data using yfR
.
Exercise 5.8 – downloading stock prices
In this exercise, we will look at how to specify the different parameters so that we can download stock prices from Yahoo! Finance, including the ticker name and date range:
- Install and load the
yfR
package:>>> install.packages("yfR") >>...