vendredi 15 mars 2019

Selecting Values and creating a Dummie

I am new in the world of R.

I want to create a dummie from a dataframe when two statements in colums are true at the same row. I created a row which is called Dummie with:

df['Dummie'] = 0 

Now i want a "1" in the column Dummie where the statements are true otherwise 0.

My example: If row A = No and row B = Berlin write 1 in colum Dummie

      A       B        Dummie

1    Yes    London       0         

2    No     Berlin       1

3    Yes    Berlin       0

Thank you for your help!

Aucun commentaire:

Enregistrer un commentaire