Using pipeline for importing values from other columns with a condition

Viewed 20

I have the following question:

I have the following code that runs and works properly. In this code, I put a value from column3 into column1 under the condition that column2 is equal to x.

df1$column1[df1$column2=='x'] <- df1$column3[df1$column2=='x']

However, as I would like to have my R code run smoothly, I would like to do this in a pipeline (with dplyr as package).

Is this possible and if yes, how?

Thank you in advance!

0 Answers
Related