Passer au contenu

This function verifies that a given data frame is compliant to a POM export, that means it contains all required columns. If any required column is missing, it stops execution and provides a clear error message listing missing and present columns. If all required columns are present, it returns TRUE and prints a confirmation message.

Utilisation

check_pom_csv(filepath, required = c("DATE", "PLUIE"))

Arguments

filepath

Path to the .csv file to check.

required

A character vector of column names that must be present in df. Default is c("DATE", "PLUIE").

Valeur de retour

Returns TRUE if the csv file is compliant (csv and all required columns presents), else stops execution with an error message.

Détails

  • The function first checks if filepath is indeed a csv file.

  • It then compares the names of filepath to the required columns.

  • If any columns are missing, an informative error is thrown listing missing and available columns.

  • If all required columns are present, a message is displayed confirming their presence.