[R] newbie lapply question

Domenico Vistocco vistocco at unicas.it
Wed Dec 5 21:29:41 CET 2007


I am not sure to understand your problem, but it seems to me that you 
can use directly the function on the range of the dates:

 > x=as.Date(c('2007-01-01','2007-01-02'))
 > fff=function(x){y=x+1;return(y)}
 > fff(x)
[1] "2007-01-02" "2007-01-03"
 > class(fff(x))
[1] "Date"

Perhaps your function use a different input (not a vector of dates but a 
dataframe)?

domenico vistocco

Ranjan Bagchi wrote:
> On Wed, 5 Dec 2007, Prof Brian Ripley wrote:
>   
>> [...]
>>     
>
> Thanks I'll read it more carefully.
>
>   
>> Perhaps if you told us what you are trying to achieve we might be able to 
>> help you achieve it.
>>
>>     
>
> I have a function which takes a date as an argument.  I've tested it, and 
> I'd like to run it over a range of dates.  So I'm looking at apply- or 
> map- type functions.
>
>   
>> -- 
>> Brian D. Ripley,                  ripley at stats.ox.ac.uk
>> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
>> University of Oxford,             Tel:  +44 1865 272861 (self)
>> 1 South Parks Road,                     +44 1865 272866 (PA)
>> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>>
>>
>>
>>     
>
> ______________________________________________
> R-help at 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.
>
>



More information about the R-help mailing list