I am cleaning survey data in R where a matrix question is saved across multiple columns based on whether they selected the checkbox or not. I would like to set certain rows missing across these columns if they meet a certain condition (e.g. selected 2 checkboxes that are conflicting), and if they do not meet the condition, I would like the values across these columns to remain unchanged.

What do I enter in the space if the condition is FALSE so that the original values across all the columns are kept? As I understand it, that FALSE value does not accept a list of columns. If this cannot work, what is another function to use instead of ifelse to modify values across several columns if a condition is TRUE? (with no required value if the condition is FALSE)

The code I have been trying to modify is below:

mutate(across(listofcolumns, ~ifelse(condition, -99, "not sure what to put here")))
0

There are 0 answers