[R] julian day form POSIXt object
maxbre
mbressan at arpa.veneto.it
Thu Sep 29 16:10:02 CEST 2011
hello all,
this is my reproducible example data frame
test<-structure(list(date = structure(c(1262300400, 1262304000, 1262304000,
1262307600, 1262307600, 1262311200, 1262311200, 1262314800, 1262314800,
1262318400, 1262318400, 1262322000, 1262322000, 1262325600, 1262325600,
1262329200, 1262329200, 1262332800, 1262332800, 1262336400, 1262336400,
1262340000, 1262340000, 1262343600, 1262343600, 1262347200, 1262347200,
1262350800, 1262350800, 1262354400, 1262354400, 1262358000, 1262358000,
1262361600, 1262361600, 1262365200, 1262365200, 1262368800, 1262368800,
1262372400, 1262372400, 1262376000, 1262376000, 1262379600, 1262379600,
1262383200, 1262383200, 1262386800), class = c("POSIXct", "POSIXt"
), tzone = "")), .Names = "date", row.names = c(NA, -48L), class =
"data.frame")
given that, my objective is to create a new variable accounting for the
julian day (i.e. the number of consecutive days elapsed from a fixed origin
date)
and these are (among many others) my (most) unsuccessful attempts…
library(chron)
#not working!
test$jday<-julian(test$date, origin=as.POSIXct(test$date))
#not working!
test$jday<-julian(test$date, origin=test$date)
#not working!
test$jday <-julian(as.Date(test$date, "%m"),
as.Date(test$date, "%d"),
as.Date(test$date, "%Y"),
origin=c(month=1, day=0, year=2010))
any help for this?
thanks a lot
max
--
View this message in context: http://r.789695.n4.nabble.com/julian-day-form-POSIXt-object-tp3855885p3855885.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list