Thanks a lot to all of you, it works now!!!!
Cheers,
Solène Goy> Subject: Re: [R] How to get the day of the year> From: [EMAIL 
PROTECTED]> To: [EMAIL PROTECTED]> CC: r-help@r-project.org> Date: Wed, 1 Oct 
2008 13:52:09 +0100> > On Wed, 2008-10-01 at 08:42 +0000, Solene Goy wrote:> > 
Hello,> > 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.> > Tu isn't a valid abbreviated for for the day (in my locale at least),> 
which might explain the NAs and you don't show how you tried to get the> julien 
day.> > Here are two ways that work.> > > tmp <- as.Date("Tue 10/Jul/2007 
21:59:13", format = "%a %d/%b/%Y %H:%M:%S")> > tmp> [1] "2007-07-10"> > 
format(tmp, "%j")> [1] "191"> > as.numeric(format(tmp, "%j"))> [1] 191> > tmp 
<- as.POSIXlt("Tue 10/Jul/2007 21:59:13", format = "%a %d/%b/%Y %H:%M:%S") > > 
tmp> [1] "2007-07-10 21:59:13"> > format(tmp, format = "%j")> [1] "191"> > 
as.numeric(format(tmp, format = "%j"))> [1] 191> > Is this what you wanted?> > 
G> > > > > Well... I need your help, please!> > Thanks in advance> > Yours 
sincerely,> > Solne Goy> > 
_________________________________________________________________> > > > 
[[elided Hotmail spam]]> > > > [[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.> -- > 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%> Dr. 
Gavin Simpson [t] +44 (0)20 7679 0522> ECRC, UCL Geography, [f] +44 (0)20 7679 
0565> Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk> Gower Street, 
London [w] http://www.ucl.ac.uk/~ucfagls/> UK. WC1E 6BT. [w] 
http://www.freshwaters.org.uk> 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%> 
_________________________________________________________________

[[elided Hotmail spam]]

        [[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.

Reply via email to