Given the following data frame:
df <- data.frame(c("1990, 1991", "1997, 2004", "2005"), c("1991, 1999", "1994", "1995, 2011"))
I want to create a 3rd column to the right in the data frame, which pastes the lowest year in the row based on the two columns.
An element that for instance shows "1990, 1991" is supposed to indicate two different years that are to be looked at separately.
So in the first row, R will analyse the years:
1990, 1991, 1991 and 1999 and then write 1990 in the third column since it's the lowest out of them all.
The final table should look like this:
df <- data.frame(c("1990, 1991", "1997, 2004", "2005"), c("1991, 1999", "1994", "1995, 2011"), c("1990", "1994", "1995"))