Bug fix:
first.day.of.quarter = function(date)
{
t = first.day.of.month(date)
l = month(date) %% 3
if (l == 0) return(t)
t = seq.Date(t, by = -1 month, length = l)
return(t[length(t)])
}
But the *apply part still does not work.
--
View this message in context:
Try
library(zoo)
x - as.Date(seq(1, 500, 50)) # test data
as.Date(as.yearmon(x))
as.Date(as.yearqtr(x))
On Sun, Feb 14, 2010 at 8:59 AM, Dimitri Shvorob
dimitri.shvo...@gmail.com wrote:
Dataframe cust has Date-type column open.date. I wish to set up another
column, with (first day of) the
Many thanks, but my focus is actually on *apply usage.
--
View this message in context:
http://n4.nabble.com/Newbie-woes-with-apply-tp1555149p1555329.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
Your function is not receiving what you may think its receiving. Try this:
x - Sys.Date() + 1:3
junk - lapply(x, print)
[1] 14655
[1] 14656
[1] 14657
So add this as the first statement in the body of each of your functions:
date - as.Date(date, 1970-01-01)
and then using x from above try
4 matches
Mail list logo