Here is my solution to produce a date value if your data set only has week values associated with data (ie no date). It gives the first monday of the week. Michael Folkes ____________________
s <- seq(as.Date("2010-01-01"), as.Date("2010-12-31"), by = "day") #produce all days of the year series.mon<-data.frame(day.monday=s[format(s, "%w") == "1"],week.val=as.integer(format(s[format(s, "%w") == "1"],"%W"))) #calc week value for every day my.data.weeks<-sort(sample(1:52, size = 10, replace = FALSE)) #fictitious weekly data (assuming I don't have the associated date) data.frame(my.data.weeks, first.weekday=series.mon[ series.mon$week.val %in% my.data.weeks,1]) #combine [[alternative HTML version deleted]] ______________________________________________ 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.