2016-01-30 55 views
0

我想设定一个时间变量,以便将其用于对存储在向量次比较和我编写以下:如何初始化时间变量?

> openingTime <- as.POSIXct('08:00:00 AM', format='%H:%M:S %p', tzone = "EET") 
> openingTime 
[1] NA 

而且

> dput(openingTime) 
structure(NA_real_, class = c("POSIXct", "POSIXt"), tzone = "") 

我在做什么错在那里?

+3

你缺少在S'的'前面的''%的迹象,而你应该使用'tz'而不是'tzone'。尝试'opensTime < - as.POSIXct('08:00:00 AM',format ='%H:%M:%S%p',tz =“EET”)' – RHertel

+1

不正确的语法='NA'。 –

+0

谢谢,这样做! – orestisf

回答

0

由于commented,为了获得不同的工作指出了@rhertel,正确的语法是:

openingTime <- as.POSIXct('08:00:00 AM', format='%H:%M:%S %p', tz = "EET")