I have a dataset with a column that outlines the amount someone drinks fruit juice, based on a survey. The recipients can respond how many times they drink juice daily, weekly, or monthly.
The column is set as a 3 digit integer, where the first number is whether they chose daily/weekly/monthly, and the remaining digits are how many times they drank juice within that period. So 104 would mean they drink juice 4 times per day. 209 would mean 9 times per week. etc.
This is the structure:
juice <- c(101,204,310)
I want to create a new column which standardizes the data, so that it's all a "per week" figure. So if the integer begins with a 1 (daily), it should multiply the second 2 digits (as a single number e.g. 04 = 4 times) by 7 and remove the "1" from the start. If it begins with 2 (weekly), just remove the first digit. If it begins with 3 (monthly), divide by 30 and multiply by 7 and remove the first digit.
I am new to R and have no idea how to approach this - any help would be greatly appreciated!