I have a dataframe for which I need to add a factor column based on a conditional statement. Here is the data.
Code:
morstats.agri.f <- morocc
you can use ifelse like this
dataframe$periodframe <- ifelse(dataframe$year > 1991,"post-1991", "pre-1991")