# Conditional Function in R [closed]

I have an R function for (i in 1:10) that reads in data and performs some cleaning. Is it possible to write a flexible statement to execute certain parts of the code conditionally, for example have different steps for i = 2 and 8?

## closed as too broad by Peter, georg-un, Mark.F, Dan Scally, Stephen Rauch♦Aug 14 at 12:44

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Hi, welcome to the forum. Your question is very vague. Please add more details in future questions and make sure you describe your problem in a good way. – Peter Aug 14 at 8:10

for (i in 1:10){