I am using readLines to read the first 4 lines of csv files to determine what the headers are so I can concatenate files with similar headers. readLines produces difficult output that looks like this (this is only the first line as an example):
output <- readLines(one_min_file, n = 4)
[1] "\"TOA5\",\"Shelton 2SW\",\"CR1000\",\"62704\",\"CR1000.Std.27\",\"CPU:0044-20201101.CR1\",\"35516\",\"OneMinute\""
How do I parse this into a text array or something that looks like this, or the same array that this produces?
c('TOA5','Shelton 2SW','CR1000','62704','CR1000.Std.27','CPU:0044-20201101.CR1','35516','OneMinute')
EDIT:
dput(readLines(one_min_files[h1], n = 1))
"\"TOA5\",\"Shelton 2SW\",\"CR1000\",\"62704\",\"CR1000.Std.27\",\"CPU:0044-20201101.CR1\",\"35516\",\"OneMinute\""
Try removing double quotes and splitting by
,:Or parse the line with
read.csv():Created on 2023-06-21 with reprex v2.0.2