mardi 20 juillet 2021

How to create a binary variable based off of texts in a column in R? [duplicate]

I have a df:

language
ENGL
ENGL
RUSS
SPAN
PORT
TOIS
TOIS
ENGL
ENGL
SPAN
ENGL

I would like to make a new column that is 1 if language = 0, otherwise, I would like to make it a 0.

language  English
ENGL      1
ENGL      1
RUSS      0
SPAN      0
PORT      0
TOIS      0
TOIS      0
ENGL      1
ENGL      1
SPAN      0
ENGL      1

Aucun commentaire:

Enregistrer un commentaire