powered by
Searches for a column in a data frame using multiple pattern options. If multiple columns match, warns the user and returns the first match.
find_column(patterns, column_names, verbose = FALSE)
Integer index of the first matching column, or NULL if no match found.
Character vector of regex patterns to search for.
Character vector of column names to search in.
Logical. If TRUE, prints detailed matching information.
cols <- c("codigo_faena", "numero_cala", "especie", "especies_capturadas") species_patterns <- c("especie", "species", "sp") col_index <- find_column(species_patterns, cols)
Run the code above in your browser using DataLab