你可以试试
library(gmailr)
clientid <- "...."
key <- "...."
token <- gmail_auth("read_only", clientid, key)
msgs <- messages(search = "before:2018-01-01 after:2016-01-01", include_spam_trash = FALSE)
msgs_meta <- lapply(id(msgs), message, format = "metadata")
dates <- lubridate::dmy_hms(sapply(msgs_meta, date))
addmargins(table(as.Date(dates), factor(format(dates, "%H"), levels = 0:23)))
# 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 Sum
# 2016-11-10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
# 2016-11-11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
# ...
# 2017-12-27 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
# Sum 0 0 0 0 0 0 0 0 0 0 15 5 1 0 0 4 3 2 2 0 1 22 19 3 77
在您自己提供的链接中几乎可以找到解释。