Dear R Users, 

I have data for more than 3 years. For each year I want to find the day
corresponding to Jaunary 1 of that year. For example:

> x <- c('5/5/2007','12/31/2007','1/2/2008')

> #Convert to day of year (julian date) -

> strptime(x,"%m/%d/%Y")$yday+1

[1] 125 365   2

I want to know how to do the same thing but with time added. But I still get
the day not time. Can anyone suggest what is the better way to find the
julian date with date and time ?

> x1 <- c('5/5/2007 02:00','12/31/2007 05:58','1/2/2008 16:25')

> #Convert to day of year (julian date) -

> strptime(x1,"%m/%d/%Y %H:%M")$yday+1

[1] 125 365   2

Thank you so much.

Janesh


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