Calculating days per month between interval of two dates
I have a set of events that each have a start and end date, but they take place over the scope of a number of months. I would like to create a table that shows the number of days in each month for this event. I have the following example. event_start_date <- as.Date("23/10/2012", "%d/%m/%Y") event_end_date <- as.Date("07/02/2013", "%d/%m/%Y") I would expect to get a table out as the following: Oct-12 8 Nov-12 30 Dec-12 31 Jan-13 31 Feb-13 7 Does anybody know about a smart and elegant way of doing this or is creating a system of loops the only viable method? Jochem This is not necessarily