I am trying to merge some csv files into one large data frame using the following code:
library(tidyverse)
list_of_files = list.files(path = "/home/maanan/Downloads/NYCData/2017/", recursive = TRUE, pattern = "\\.csv$", full.names = TRUE)
df = readr::read_csv(list_of_files)
The code above works fine when the column names are the same. But when I try to merge data sets which have different column names it gives me the following error:
Error: Files must have consistent column names:
* File 1 column 1 is: Trip Duration
* File 4 column 1 is: tripduration
I am trying to combine 12 monthly data sets, 6 of them have names like this:
"Trip Duration" "Start Time" "Stop Time" "Start Station ID" "Start Station Name"
The other 6 data sets have names like this:
"tripduration" "starttime" "stoptime" "start station id" "start station name"
I would be grateful if someone could help me solve this problem. Thank you.