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 > head(df$date) [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) > 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? ______________________________________________ R-help@r-project.org mailing list 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.