0

I want to read from a directory many csv-files with approximately 120 columns and import the content into a rds-file. Every day new csv-file will be generated and i import that csv-files, which are newer than the latest modificationdate of the rds-file. Sometimes it happens, that there are new columns in the csv or others are not longer supportet and disappear. I have an automated procedure, which runs every day, imports the new csv-files and their contents and appends it to the existing rds-file with rbind.

Everything works fine if the numbers and names of columns do not change. Some years ago i solved this by manual adding a column in the rds-file.

At the end i need a rds-file with all the past data for many years. And every column shoud have the correct columnname for all columns which ever has been in the csv-files. Has anyone some ideas how to solve my requirements?

Rüdiger Kladt
  • 119
  • 1
  • 7
  • Read the column names of the rds file into a vector. Read the column names from the new csv into a vector. `csv_names %in% rds_names` will give you a logical vector to tell you if any new columns need adding. – Paul Stafford Allen Feb 07 '23 at 10:02

0 Answers0