I want to change column name (from T2 [?C] to T2 [°C]) of data stored in .csv. I am using following code in R
setwd("D:/Test")
fs::dir_tree()
dirlist <- list.files(full.names = FALSE, no.. = TRUE)
dirlist
read_the_files <- function(filelist){
lapply(filelist, function(file) {
fread(file, skip = "Date/Time\tXY [XY]")
})
}
adj_col_nam <- function(dt_list){
lapply(dt_list, FUN = function(x){
setnames(x, old = "T2 [?C]", new = "T2 [°C]", skip_absent = TRUE)
return(x)
})
}
In the output, it does change the column name but to T2 (°C). Why it is returning it with an additional  sign? How can I get only T2 [°C]?
Following are the updated details as per the comment:
dput(head(dt_list[[1]]))
Error in head(dt_list[[1]]) : object 'dt_list' not found
dput(head(read_the_files[[1]]))
Error in read_the_files[[1]] : object of type 'closure' is not subsettable
dput(head(filelist[[1]]))
"NYORK/NYORK_2005-01_0100_DC_mixed.txt"
dput(head(file[[1]]))
Error in file[[1]] : object of type 'closure' is not subsettable
Sys.getlocale()
[1]"LC_COLLATE=English_India.utf8;LC_CTYPE=English_India.utf8;LC_MONETARY=English_India.utf8;LC_NUMERIC=C;LC_TIME=English_India.utf8"
Sample data
Date/Time Press [Pa] T2 [?C]
2004-08-01S00:00:00 1013 0
2004-08-01S00:01:00 1013 0
2004-08-01S00:02:00 1013 0
2004-08-01S00:03:00 1013 0