[R] Number of Days

umeno umeno at students.uiuc.edu
Thu Nov 6 06:33:33 CET 2003

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

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

More information about the R-help mailing list