課程
/云計算&大數(shù)據(jù)
/大數(shù)據(jù)
/R語言基礎
x1<-"Jan 1, 2015 01:01" strptime(x1, "%B %d, %Y %H:%M") [1] NA 為什么我strptime函數(shù)使用不成功呢。。
2015-12-26
源自:R語言基礎 2-8
正在回答
%B?Full month name in the current locale. (Also matches abbreviated name on input.)
語言環(huán)境的問題,可以用
Sys.setenv(LANGUAGE = "en")
> x1 <- "Jan 1, 2015 01:01"
> strptime(x1, "%B %d, %Y %H:%M")
[1] NA
x1 <- "一月 1, 2015 01:01"
[1] "2015-01-01 01:01:00 CST"
本人不知道怎么回答上面樓上了
把"Jan"改成"1月"或者"一月"就可以了.
> x1 <- "一月 1, 2015 01:01"> strptime(x1, "%B %d, %Y %H:%M")[1] "2015-01-01 01:01:00 CST"
> x1 <- "一月 1, 2015 01:01"
老師視頻中演示時"months(p)"的結果是"Jan",但我的是"一月".
> p <- as.POSIXlt(x)> p[1] "2016-01-01 UTC"> months(p)[1] "一月"
> p <- as.POSIXlt(x)
> p
[1] "2016-01-01 UTC"
> months(p)
[1] "一月"
我這里 Sys.getlocale() 、Sys.timezone() 和 ?Sys.timezone()?的值.
> Sys.time()[1] "2016-01-05 21:52:35 CST"> Sys.getlocale()[1] "LC_COLLATE=Chinese (Simplified)_China.936;LC_CTYPE=Chinese (Simplified)_China.936;LC_MONETARY=Chinese (Simplified)_China.936;LC_NUMERIC=C;LC_TIME=Chinese (Simplified)_China.936"> Sys.timezone()[1] "Asia/Taipei"
> Sys.time()
[1] "2016-01-05 21:52:35 CST"
> Sys.getlocale()
[1] "LC_COLLATE=Chinese (Simplified)_China.936;LC_CTYPE=Chinese (Simplified)_China.936;LC_MONETARY=Chinese (Simplified)_China.936;LC_NUMERIC=C;LC_TIME=Chinese (Simplified)_China.936"
> Sys.timezone()
[1] "Asia/Taipei"
你把Jan換成一月應該就可以了
Lshin
Andy992
俊介的憂傷 回復 Lshin
本人親自測試,是完全成功的:[1] "2015-01-01 01:01:00 EST", NA只有一種情況下會出現(xiàn),x1為空白的字符串的時候
舉報
本R語言基礎教程,教你如何在R中操縱自己數(shù)據(jù),快速入門
1 回答關于R語言中的strptime()函數(shù)
1 回答沒有實現(xiàn)視頻中 strptime函數(shù)的演示
4 回答R數(shù)據(jù)結構中strptime函數(shù)返回NA的問題
1 回答strptime
1 回答為什么as不能調用names()這個函數(shù)來強制命名呢
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關注慕課網(wǎng)微信公眾號
2016-09-14
%B?Full month name in the current locale. (Also matches abbreviated name on input.)
語言環(huán)境的問題,可以用
Sys.setenv(LANGUAGE = "en")
2016-03-18
> x1 <- "Jan 1, 2015 01:01"
> strptime(x1, "%B %d, %Y %H:%M")
[1] NA
x1 <- "一月 1, 2015 01:01"
> strptime(x1, "%B %d, %Y %H:%M")
[1] "2015-01-01 01:01:00 CST"
本人不知道怎么回答上面樓上了
2016-01-05
把"Jan"改成"1月"或者"一月"就可以了.
老師視頻中演示時"months(p)"的結果是"Jan",但我的是"一月".
我這里 Sys.getlocale() 、Sys.timezone() 和 ?Sys.timezone()?的值.
2016-01-04
你把Jan換成一月應該就可以了
2015-12-26
本人親自測試,是完全成功的:[1] "2015-01-01 01:01:00 EST", NA只有一種情況下會出現(xiàn),x1為空白的字符串的時候