That's it. Nice and easy :)
Thanks!
Stefan
-Original Message-
From: Tyler Rinker [mailto:tyler_rin...@hotmail.com]
Sent: Mon 4/30/2012 6:40 PM
To: Schreiber, Stefan; r-help@r-project.org
Subject: RE: [R] for loop problem
I don't really work with dates but thought I'd pass
(as.character(M), "\\-"))
N <- data.frame(apply(N, 2, as.numeric))
colnames(N) <- c('year', 'month', 'day')
with(N, date.int(month=month, year=year, day=day))
> Date: Mon, 30 Apr 2012 17:57:02 -0600
>
Perhaps this is easier: convert your data to Date objects and use the
yday (year day) function from the lubridate package:
i.e., something like this:
jd <- apply(DAT, 1, function(x) as.Date(paste(x, collapse = " "),
format = "%Y %m %d")
# Just a guess you might have to debug it a little
yday(jd)
Hi all,
I was wondering if you can help me with the following situation:
I have a data frame that includes weather station data for 30 years in
the form:
YEAR, MONTH, DAY, TEMP
1970, 01, 01, -15
...
1999, 12, 31, -21
I would like to add another variable "JULIAN" that assigns the integers
1 to 3
4 matches
Mail list logo