I have several dataframes like this:
PV001_BWA
Pos Depth Region
942 32 3.aprotein
943 33 3.aprotein
944 32 3.aprotein
945 35 3.aprotein
946 30 3.aprotein
947 32 3.aprotein
948 32 3.aprotein
949 32 3.aprotein
950 30 CP
951 24 CP
952 20 CP
953 11 CP
954 19 CP
955 25 CP
I would like to know how to be able to generate one more column in the dataframe with the word "discard" if the value of depth does not reach 20 or "do not discard" if it exceeds the value of 20 in said column. So that it generates something like this:
PV001_BWA
Pos Depth Region Tag
942 32 3.aprotein Descartar
943 33 3.aprotein Descartar
944 32 3.aprotein Descartar
945 35 3.aprotein Descartar
946 30 3.aprotein Descartar
947 32 3.aprotein Descartar
948 32 3.aprotein Descartar
949 32 3.aprotein Descartar
950 30 CP Descartar
951 24 CP Descartar
952 20 CP Descartar
953 11 CP Descartar
954 19 CP Descartar
955 25 CP Descartar
Thanks in advance.
To generate the new column in which each cell will have one of two possible values based on a condition, in this case whether
Depth
or not the value of is greater than 20, you can simply use the functionifelse
: