我有一个r数据集,其中包含这样的时间戳列表:2009-08-18 14:38:20 2010-08-10 14:58:25 etc
2009-08-18 14:38:20
2010-08-10 14:58:25
我想提取年份,但Posixct没有像 months(t$timestamp)
months(t$timestamp)
有没有办法只获得2009年?
查看更多
使用格式:
x <- as.POSIXct(c("2009-08-18 14:38:20", "2010-08-10 14:58:25")) format(x, "%Y")
谢谢。不知道格式