Displaying 6 results from an estimated 6 matches for "date11".
Did you mean:
date1
2017 Sep 24
0
"XLConnect" packages; Excel dates read incorrectly
Hi John,
I was able to reproduce your problem in my environment.
I modified the statement
date11<-as.Date(a_col$date, format="%Y-%m-%d")
to
date11<-as.Date(as.POSIXlt(a_col$date),format="%Y-%m-%d")
which then gives the output you would like to see (at least on my system)
> date11
[1] "2004-01-01" "2004-01-02" "2004-01-05" "2004-0...
2017 Sep 24
3
"XLConnect" packages; Excel dates read incorrectly
...gt;> a1<-readWorksheetFromFile(fl, sheet="first", colTypes="numeric")
> >>> b1<-readWorksheetFromFile(fl, sheet="second", colTypes="numeric")
> >>> a_col<-readWorksheetFromFile(fl, sheet="first")
> >>> date11<-as.Date(a_col$date, format="%Y-%m-%d")
> >>>
> >>>
> >>> The output:
> >>>> date11
> >>> [1] "2003-12-31" "2004-01-01" "2004-01-04" "2004-01-05" "2004-01-06"
> >>&...
2017 Sep 23
2
"XLConnect" packages; Excel dates read incorrectly
...t)
library(xlsx)
fl<-paste("allData_out3.xlsx")
a1<-readWorksheetFromFile(fl, sheet="first", colTypes="numeric")
b1<-readWorksheetFromFile(fl, sheet="second", colTypes="numeric")
a_col<-readWorksheetFromFile(fl, sheet="first")
date11<-as.Date(a_col$date, format="%Y-%m-%d")
The output:
> date11
[1] "2003-12-31" "2004-01-01" "2004-01-04" "2004-01-05" "2004-01-06"
"2004-01-07"
[7] "2004-01-08" "2004-01-11" "2004-01-12" &qu...
2017 Sep 23
0
"XLConnect" packages; Excel dates read incorrectly
...<-paste("allData_out3.xlsx")
> a1<-readWorksheetFromFile(fl, sheet="first", colTypes="numeric")
> b1<-readWorksheetFromFile(fl, sheet="second", colTypes="numeric")
> a_col<-readWorksheetFromFile(fl, sheet="first")
> date11<-as.Date(a_col$date, format="%Y-%m-%d")
>
>
> The output:
>> date11
> [1] "2003-12-31" "2004-01-01" "2004-01-04" "2004-01-05" "2004-01-06"
> "2004-01-07"
> [7] "2004-01-08" "2004-01-11&...
2017 Sep 23
2
"XLConnect" packages; Excel dates read incorrectly
...Data_out3.xlsx")
> > a1<-readWorksheetFromFile(fl, sheet="first", colTypes="numeric")
> > b1<-readWorksheetFromFile(fl, sheet="second", colTypes="numeric")
> > a_col<-readWorksheetFromFile(fl, sheet="first")
> > date11<-as.Date(a_col$date, format="%Y-%m-%d")
> >
> >
> > The output:
> >> date11
> > [1] "2003-12-31" "2004-01-01" "2004-01-04" "2004-01-05" "2004-01-06"
> > "2004-01-07"
> > [7] "...
2017 Sep 24
0
"XLConnect" packages; Excel dates read incorrectly
...sx")
>>> a1<-readWorksheetFromFile(fl, sheet="first", colTypes="numeric")
>>> b1<-readWorksheetFromFile(fl, sheet="second", colTypes="numeric")
>>> a_col<-readWorksheetFromFile(fl, sheet="first")
>>> date11<-as.Date(a_col$date, format="%Y-%m-%d")
>>>
>>>
>>> The output:
>>>> date11
>>> [1] "2003-12-31" "2004-01-01" "2004-01-04" "2004-01-05" "2004-01-06"
>>> "2004-01-07"
&...