The document outlines a process for loading and merging stock data for IBM from two sources: a CSV file and Yahoo Finance using the quantmod package in R. It includes steps for data cleaning, checking for missing values, and saving the final merged dataset to a new CSV file. The final output is a cleaned dataset with correctly formatted date and numerical columns.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
13 views
VBA EXAM
The document outlines a process for loading and merging stock data for IBM from two sources: a CSV file and Yahoo Finance using the quantmod package in R. It includes steps for data cleaning, checking for missing values, and saving the final merged dataset to a new CSV file. The final output is a cleaned dataset with correctly formatted date and numerical columns.
missing_summary[, missing_summary > 0] # Check if there are any missing values in the entire dataset any(is.na(data)) # Returns TRUE if there are missing values, otherwise FALSE
# Count total missing values in the entire dataset
sum(is.na(data)) # Returns 0 if there are no missing values
## NO MISSING VALUES WERE FOUND
## ENSURING CORRECT FORMAT
# Read the CSV file
data <- read.csv("Merged_Data.csv", stringsAsFactors = FALSE)
# Check the first few rows and column names
head(data) str(data)
# Convert date columns to Date format if they exist