[R] Number of Days

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Nov 6 08:13:22 CET 2003


?strptime
?as.POSIXct
?difftime

On Wed, 5 Nov 2003, umeno wrote:

> Hi everyone,
> 
> I have been trying to compute numbers of days between two dates as follows:
> 
> > x <- c("1jan1960", "2jan1960", "31mar1960", "30jul1960")
> > z <- format(x, "%d%b%Y")
> > ex <- c("1jan1961", "15jan1960", "21mar1975", "10jul1981")
> > ez <- format(ex, "%d%b%Y")
> > ez-z
> Error in ez - z : non-numeric argument to binary operator
> 
> As you may see, I am getting an error.  Can anyone tell me how I can convert z 
> and ez to numeric vectors, so that I can compute days between the 
> corresponding dates in these vectors?
> 
> thank you
> soyoko
> 
> ______________________________________
> Ms. Soyoko Umeno
> Graduate Research Assitant for the Illinois-Missouri Biotechnology Alliance (IMBA) at http://www.imba.missouri.edu/
> Ph.D. Student at the Department of Agricultural and Consumer Economics
> at the University of Illinois at Urbana-Champaign
> Office Phone: 217-333-3417 or 217-333-0364
> Fax: 217-244-4817
> Mailing Address: 1301 W. Gregory Dr. MC710, Urbana, IL 61801
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
> 

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




More information about the R-help mailing list