R:as.POSIXct返回NA

时间:2018-01-08 17:16:18

标签: r

我是在R中操纵时间的新手。我正在尝试将角色变为a =" 201304021500"使用以下代码进入POSIXct表单:

#First I turn my charcter a into the format "2013/04/02 15:00" 

    annee=substr(a,1,4)
    mois=substr(a,5,6)
    jour=substr(a,7,8)
    heure=substr(a,9,10)
    a=paste(paste(annee,mois,jour,sep="/"),paste(heure,min,sep=":"),sep=" ")

#Then I use the as.POSIXct function (as follows) that unfortunately returns NA even though the date "2013/04/02 15:00" does not correspond to the time where #the DST was #changed in France (where I am working)

> as.POSIXct(a,format="%y/%m/%d %h:%m",tz="Europe/Paris")
[1] NA

我该如何解决这个问题?非常感谢!

0 个答案:

没有答案