I am trying to convert the values of the 'age' column such that the value will increase by 1 if the months is more than 6 e.g. '56 years 8 months' to '57', or keep it as it is if months is <=6 e.g. '43 years 5 months' to '43'.
This is the data I have:
> age=data.frame(age=c(12, '43 years 5 months', 34, '56 years 8 months'))
> age
age
1 12
2 43 years 5 months
3 34
4 56 years 8 months
And this is what I want:
> age
age
1 12
2 43
3 34
4 57
I am sorry about the poor phrasing of the question, but I hope the description makes it clearer.
Thanks in advance.