Creating New Variables with Multiple Conditions

See the FAQ: How to do a minimal reproducible example reprex for beginners. Some representative data will make illustrating answers easier.