How can I convert date to continuous variable staring from 1. I tried as.numeric but R starts counting from default January 1, 1970 while my data start Oct 7, 2009.
I need to do this conversion to plot the date on two x-axes (1 and 3). Ex; Date LAI 10/7/2009 0 10/8/2009 0.004173 10/9/2009 0.009997 10/10/2009 0.009998 10/11/2009 0.009999 10/12/2009 0.009999 10/13/2009 0.009999 10/14/2009 0.009999 10/15/2009 0.009998 10/16/2009 0.009998 10/17/2009 0.009998 10/18/2009 0.009998 10/19/2009 0.009998 10/20/2009 0.009998 LAI_simulation$Date <- as.Date( LAI_simulation$Date, '%Y/%m/%d') plot(LAI~Date, data=LAI_simulation) LAI_simulation$Date<- as.numeric(LAI_simulation$Date,origin="2009-10-07") #R does not see the origin axis.Date(side=3,at=LAI_simulation$Date) Ahmed Attia, Ph.D. Agronomist & Soil Scientist [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.