Looks good, but there are some ways in which I think you’re making it more
complicated than necessary.
Two calls to plot(), with plot.new() in between, is definitely not needed.
Recalculating LAI_simulation$Date three times should not be needed.
## create example data
day0 <- as.Date('2009-10-7'
Thanks it worked for me. I wanted to plot days since planting on
x-axis 1 and years on x-axis 3.
LAI_simulation$Date <- as.Date( LAI_simulation$Date, '%Y/%m/%d')
LAI_simulation$Date <- as.integer(LAI_simulation$Date - as.Date("2009-10-07"))
plot(LAI~Date,data=LAI_simulation,xlab="Days since Oct, 7
on, TX 77840-4352
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ahmed Attia
Sent: Wednesday, July 5, 2017 1:24 PM
To: r-help
Subject: [R] Convert date to continuous variable in R
How can I convert date to continuous variable staring from 1. I tried
as.numeric but
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
4 matches
Mail list logo