rm(list=ls(all=TRUE))
getwd()
data1<- read.csv("exdata1.csv",header = T)
view(data1)
result <- tryCatch(read.csv("exdata1.csv", header = TRUE), error = function(e) e)
if (inherits(result, "error")) {
print("An error occurred while reading the CSV file.")
} else {
# CSV file was successfully read
data1 <- result
view(data1)
}