很多時間資料分析時想將時間軸轉化會發生問題,想將時間進一步化成每個禮拜幾的時候,可以利用Weekday( )或your_data$wday<====>需對應POSIXlt這種資料型態, 輸出正常為
[1] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[8] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[15] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[22] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[29] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[36] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[43] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[50] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[57] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
等等
但有時中文無法被正確辨識出現亂碼時,或想要以英文表示時,可以到系統中把語言改成英文,window版R.3.1.2的語法如下:
[1] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[8] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[15] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[22] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[29] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[36] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[43] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[50] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
[57] "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
等等
但有時中文無法被正確辨識出現亂碼時,或想要以英文表示時,可以到系統中把語言改成英文,window版R.3.1.2的語法如下:
Sys.setlocale("LC_TIME", "English")
或
Sys.setlocale("LC_TIME", "en_US") 網傳 , 我無法使用
時間的威力
沒有留言:
張貼留言