On Wed, Feb 22, 2012 at 8:09 AM, arunkumar1111 <akpbond...@gmail.com> wrote: > Hi > > My data looks like this > > startDate="2008-06-01" > > dateRange =c( "2008-10-01","2008-12-01") > Is there any method to find the week number from the startDate range >
Is the question how many weeks are from the startDate to each of the dateRange dates? If so, then try this: startDate <- as.Date("2008-06-01") dateRange <- as.Date(c( "2008-10-01","2008-12-01")) floor(as.numeric(dateRange - startDate) / 7) or depending on what the week is supposed to be we might want ceiling in place of floor or neither floor nor ceiling if we want fractional weeks. -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.