I have data which represents age, it is given as for example 8y 10m 27d
, where y
are years, m
are months, and d
are days.
I've tried using gsub()
to replace the y
, m
and d
with *365+
, *30+
and nothing respectively, and then using as.numeric()
, but R doesn't know that it should calculate first so it just returns NA.
Is there a way to convert that kind of string to the exact number of days?
Sorry for the formatting, I can't remember the last time I was on this site so I forgot how to format.