在 R 中读取推文时间

Reading tweet time in R

我在 json 下载了推文 format.Now 我想表示关于 time.There 的推文创建率是一个名为 'created at' 的变量,它表示推文何时是 created.I 具有这种格式的变量:

Thu Apr 09 15:43:18 +0000 2015

我能够阅读所有其他内容,但不知道如何阅读这个+0000.Previously我尝试在 R 中阅读这个,这是成功的:

Thu Apr 09 15:43:18 2015

为了读取上述变量,我使用了以下代码:

earlier <-strptime("Thu Apr 09 15:43:18 2015","%a %b %d %H:%M:%S %Y")

请帮助我如何阅读 R 中的第一个代码。

你可以试试

 as.POSIXct('Thu Apr 09 15:43:18 +0000 2015', 
                        format='%a %b %d %H:%M:%S %z %Y', tz='GMT')
 #[1] "2015-04-09 15:43:18 GMT"

根据?strptime

‘%z’ Signed offset in hours and minutes from UTC, so ‘-0800’ is 8 hours behind UTC. Values up to ‘+1400’ are accepted as from R 3.1.1: previous versions only accepted up to ‘+1200’. (Standard only for output.)