On Fri, 23 Oct 2009 12:06:28 -0600 Fang (Betty) Yang <fang.y...@ualberta.ca> wrote: > dates <- c("02/27/1992", "02/27/1992", "01/14/1992", "02/28/1992", > "02/01/1992") > > Could anyone give me some R codes to get the same results as above' > (extract days from dates), please?
If your dates are real dates, and not just character strings, the simplest way is to use the 'weekdays' functions. For you data: # Convert the character strings to dates dates=as.Date(dates, format="%m/%d/%Y") # Extract the day names (note that these are localised day names) weekdays(dates) See the help file for 'weekdays' for details. -- Karl Ove Hufthammer ______________________________________________ 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.