create a new column and use an ifelse statment to indicate by a word when another column has specific character values in r

# Assuming you have a dataframe named df with a column named specific_column

df$new_column <- ifelse(df$specific_column %in% c("value1", "value2"), "word_to_indicate", "default_value")
186 chars
4 lines

related categories

gistlibby LogSnag