Skip to contents

This function reads a CSV or Excel (.xlsx) file and performs several cleaning steps:

  1. Detects file type based on extension.

  2. Optionally converts column names to uppercase using janitor::clean_names.

  3. Attempts to parse character columns as dates in ymd format.

  4. Converts remaining character columns to uppercase.

Usage

read_raw_data(file, sheet = 1, col_caps = TRUE, str_caps = TRUE)

Arguments

file

A string specifying the path to the CSV or Excel file.

sheet

Optional: sheet name or index if reading an Excel file. Defaults to the first sheet.

col_caps

Logical. Whether to convert column names to uppercase. Default is TRUE.

str_caps

Deprecated. Character strings are now always converted to uppercase.

Value

A data frame with cleaned column names and data.