R 語言 匯入xlsx 如何解決 日期+時間欄位 不正常顯示
首先 我想要匯入一個xlsx檔 內容大約是這樣
其中有一欄(col) 含有日期+時間資訊
R語言程式碼如下,使用 openxlsx 包中的 read.xlsx 函數
library(openxlsx) # read.xlsx
dff1=openxlsx::read.xlsx('./xlsx/ID-004_Date-2017-11-14_All.csv.xlsx')
結果如下 其中日期+時間格式跑掉了
換個包看看
library(readxl) #read_excel
dff2 <- readxl::read_excel('./xlsx/ID-004_Date-2017-11-14_All.csv.xlsx')
日期時間顯示正常 完工
參考資料
https://stackoverflow.com/questions/30158695/reading-a-string-column-in-xlsx-with-date-and-time-values
http://weitinglin.com/2017/03/20/%E4%BD%BF%E7%94%A8r%E8%99%95%E7%90%86%E6%99%82%E9%96%93%E8%B3%87%E6%96%99%EF%BC%88datetimeclasses%EF%BC%89%E7%9A%84%E6%A0%BC%E5%BC%8F%EF%BC%88lubricate-posixltposixlc%EF%BC%89/
https://stackoverflow.com/questions/30158695/reading-a-string-column-in-xlsx-with-date-and-time-values
http://weitinglin.com/2017/03/20/%E4%BD%BF%E7%94%A8r%E8%99%95%E7%90%86%E6%99%82%E9%96%93%E8%B3%87%E6%96%99%EF%BC%88datetimeclasses%EF%BC%89%E7%9A%84%E6%A0%BC%E5%BC%8F%EF%BC%88lubricate-posixltposixlc%EF%BC%89/