Skip to contents

This function takes a named list and appends its values as a new column to a dataframe. The name of the named list is matched with the dataframe's column names.

Usage

bind_new_data(df, named_list)

Arguments

df

The dataframe to which the data will be added.

named_list

The named list whose elements should be added as a new column to the dataframe.

Value

The dataframe with the added column.

Examples

df <- data.frame(Name = c("John", "Doe"), Age = c(25, 30))
new_data <- list(Designation = "Manager")
df <- bind_new_data(df, new_data)