Using ifelse statement for multiple values in a column
问题 I have a table with approximately 3000 rows with data in the form of : Number Type 10001 0 10005 7 10006 0 10007 14 10012 16 10022 14 10023 0 10024 0 10029 7 10035 17 10045 14 I want to add a third column so that the table looks like : Number Type SCHEach 10001 0 0 10005 7 0 10006 0 0 10007 14 0 10012 16 1 10022 14 0 10023 0 0 10024 0 0 10029 7 0 10035 17 1 10045 14 0 where values in the SCHEach column are based on values in the Type column. If values in the Type column are 16,17,21, or 22,