Skip to contents

This function assigns feature names to the rows of a dataframe based on a specified column from another dataframe. If no column is specified, it assigns sequential numbers as feature names.

Usage

add_feature_names(data, clean_data, feature_name_columns)

Arguments

data

A dataframe containing the original data with feature names.

clean_data

A dataframe to which the feature names will be added.

feature_name_columns

A string specifying the name of the feature columns in `data`. If `NA`, sequential numbers will be used as feature names.

Value

The `clean_data` dataframe with updated row names.

Details

The function performs the following operations: - Extracts feature names from the specified column in `data`, ignoring `NA` values. - Ensures the feature names are unique and match the number of rows in `clean_data`. - Assigns the feature names to the rows of `clean_data`. - If `feature_name_column` is `NA`, assigns sequential numbers (1, 2, 3, etc.) as feature names and issues a message.