Hello guys. I am trying to import csv files and read few columns from csv to perform data manipulaiton but R seems not recognising coulmn names because csv file has column name with spaces. If i put single character in column name of csv file then there is no problem for R in reading this.
files = list.files()
combinecsv = data.frame(check.names=TRUE)
for (i in 1:length(files)){
print(paste0("combining ", files[i]))
csv = read.csv(file = files[i])
combinecsv= rbind(combinecsv,csv)
}
#this is where the problem is occuring
after sum function, the R is not recognising column names from csv files.
combinecsv = combinecsv %>%
mutate( Col1 = sum (Column 1 name with spaces, na.rm = T),
Col2 = sum(Column 2 name with spaces, na.rm = T),
Col3 = sum(Column 3 name with spaces, na.rm = T),
Col4 = sum( Column 4 name with spaces , na.rm = T) )