I am working from two Excel sheets. This is my code:
# Read the first dataset
df1 <- read.csv("ATLweather.csv")
# Read the second dataset
df2 <- read.csv("electricityprices.csv")
# Merge the datasets
library("dplyr")
merged_df <- left_join(df1, df2, by = "Timestamp")
head(merged_df)
library(writexl)
# Save the merged data frame as an Excel file
write_xlsx(merged_df, path = "C:/Users/Nathaniel/Documents/newfile.xlsx")
This successfully merges the data sets, but replaces all the data in my "cost" column with "NA" (pictured below in my environment).
This is my first time doing any coding, so I'm at a loss as to how to fix this. What am I doing wrong?