I am trying to create a new column of values based on the values of another column. If the values in column iucnStatus are "LC" or "NT" I want the value in the new column (threatened) to be "Not_Threatened". If the values in iucnStatus are "VU", "EN", "CR", "EW", or "EX" I want the value in the new column (threatened) to be "Threatened." I got this far in writing code to create the new column:
df<-read.csv('master2.csv')
df$threatened <-apply(df$iucnStatus, 1,function(x)
But I wasn't sure what function to pass into function(x). Also open to any other solutions that don't use the apply function.