# Load the reshape2 package
install.packages("readr")
install.packages("tidyr")
library(readr)
library(tidyr)
# Import the data from the CSV file
datastock_df <- read.csv("stock_df.csv")
# Reshape the data from wide to long format
stock_df_long <- pivot_longer(datastock_df,
cols = -company,
names_to = "week",
values_to = "price",
names_prefix = "2019_week")
stock_df_long$year <- 2019
head(stock_df_long)