urlfile <- “https://raw.github.com/utjimmyx/resources/master/avocado_HAA.csv” data <- read.csv(urlfile, fileEncoding=“UTF-8-BOM”, stringsAsFactors = FALSE) colnames(data) # Check column names str(data) # Check data structure head(data) # Preview first few rows summary(data) # Get summary statistics data <- data %>% select(-contains(“unnamed”)) # Remove index column if present colnames(data) <- gsub(“^ï..”, ““, colnames(data)) # Remove encoding artifacts colnames(data) <- tolower(colnames(data)) # Convert all column names to lowercase colnames(data) head(data\(date) # Replace 'date' with the actual column name summary(data\)date) colnames(data)[colnames(data) == ”date”] <-”Date” # Change the column name if needed data\(Date <- as.Date(data\)Date, format=“%Y-%m-%d”) # If stored as YYYY-MM-DD summary(data\(Date) head(data\)Date) colnames(data) colnames(data) <- gsub(“^ï..”, ““, colnames(data)) # Fix encoding issues colnames(data) <- tolower(colnames(data)) # Convert all column names to lowercase colnames(data) colnames(data)[colnames(data) == ”actual_column_name”] <-”Date” head(data$Date) # If this prints only NA, the column might not be correct head(data, 20)