-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of arun
Sent: Friday, December 06, 2013 3:11 PM
To: R help
Subject: Re: [R] Wrong date fromat?
Hi,
Try
vec1 <- 10958:10963
as.Date(vec1,origin="1960-01-01")
#[1] "1990-01-01" "1990-01-02" "1990-01-03" "1990-01-04" "1990-01-05"
#[6] "1990-01-06"
A.K.
I have imported a stata data into R and wanted to convert the date.
The format went OK, but the output doesn't represent my data. The head
of the imported data is this one
[1] 10958 10959 10960 10961 10962 10963
I tried to convert the date using the zoo package:
library("zoo")
df$date<-as.Date(df$date)
head(df$date)
[1] "2000-01-02" "2000-01-03" "2000-01-04" "2000-01-05" "2000-01-06"
"2000-01-07"
However my date starts with January 1, 1990 and the converted data starts
from January 2, 2000.
What have I done wrong?