> I am new to R and I would like to get the day of the year from > numerous data in the following form: %a %d/%b/%Y %H:%M:%S (for > example from Tu 10/Jul/2007 21:59:13 I would like to get 191) > > Whatever I try, I get NAs.
The problem is th 'Tu' bit. Abbreviated day-of-week names and three letters long. You'll have to replace/ delete them. datestr <- "Tu 10/Jul/2007 21:59:13" newdatestr <- sub("Tu", "Tue", datestr) dateval <- strptime(newdatestr, "%a %d/%b/%Y %H:%M:%S") dateval$yday #190 Regards, Richie. Mathematical Sciences Unit HSL ------------------------------------------------------------------------ ATTENTION: This message contains privileged and confidential inform...{{dropped:20}} ______________________________________________ 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.