Why is the read.table function storing the data in a single column.
library(tidyverse)
library(lubridate)
# List files in the directory
file_list <- list.files(pattern = "*.txt")
file_list
filenames <- Sys.glob("*.txt")
filenames
# Create an empty list to store time series objects
ts_list <- list()
# Loop through each file
for (filename in filenames) {
tryCatch({
# Read data from text file
data <- read.table(filename, skip = 10, nrows = 31, sep = "\t")
}, error = function(e) {
cat("Error reading file:", filename, "\n")
print(e)
})
}