Convert age entered as 'X Weeks, Y Days, Z hours' in R
问题 I have an age variable containing observations that follow this (inconsistent) format: 3 weeks, 2 days, 4 hours 4 weeks, 6 days, 12 hours 3 days, 18 hours 4 days, 3 hours 7 hours 8 hours I need to convert each observation to hours using R. I have used strsplit(vector, ',') to split the variable at each comma. I am running trouble because splitting each observation at the ',' yields anywhere from 1 to 3 entries for each observation. I do not know how to properly index these entries so that I