我有来自一堆服务器的 30 秒粒度数据。我想将此数据滚动到每台服务器的 15 分钟。
我的数据框是这样的:
输出(p)
structure(list(DATE = c("2013-04-15 02:47:32", "2013-04-15 02:48:02",
"2013-04-15 02:48:32", "2013-04-15 02:49:02", "2013-04-15 02:49:32",
"2013-04-15 02:50:02", "2013-04-15 02:50:32", "2013-04-15 02:51:02",
"2013-04-15 02:51:32", "2013-04-15 02:52:02", "2013-04-15 02:52:32",
"2013-04-15 02:53:02", "2013-04-15 02:53:32", "2013-04-15 02:54:02",
"2013-04-15 02:54:32", "2013-04-15 02:55:02", "2013-04-15 02:55:32",
"2013-04-15 02:56:02", "2013-04-15 02:56:32", "2013-04-15 02:57:02",
"2013-04-29 17:33:07", "2013-04-29 17:33:37", "2013-04-29 17:34:07",
"2013-04-29 17:34:37", "2013-04-29 17:35:07", "2013-04-29 17:35:37",
"2013-04-29 17:36:07", "2013-04-29 17:36:37", "2013-04-29 17:37:07",
"2013-04-29 17:37:37", "2013-04-29 17:38:07", "2013-04-29 17:38:37",
"2013-04-29 17:39:07", "2013-04-29 17:39:37", "2013-04-29 17:40:07",
"2013-04-29 17:40:37", "2013-04-29 17:41:07", "2013-04-29 17:41:37",
"2013-04-29 17:42:07", "2013-04-29 17:42:37"), Server = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("ServerA", "ServerB"), class = "factor"),
CPU = c(70L, 71L, 72L, 72L, 72L, 73L, 73L, 74L, 73L, 73L,
73L, 73L, 71L, 74L, 72L, 72L, 70L, 72L, 71L, 70L, 78L, 79L,
79L, 78L, 79L, 77L, 78L, 80L, 81L, 80L, 80L, 79L, 79L, 79L,
81L, 79L, 78L, 79L, 79L, 79L)), .Names = c("DATE", "Server",
"CPU"), class = "data.frame", row.names = c(NA, -40L))
有没有一种简单的方法可以将每台服务器的 30 秒数据滚动到 15 分钟数据?我可以在此数据框中拥有 2 台以上的服务器。
例如,如果我的数据如下,其中包括 30 秒的数据。我需要平均每 15 分钟的 CPU 数据。
DATE SERVER CPU
1 2013-04-15 02:47:32 ServerA 70
2 2013-04-15 02:48:02 ServerA 71
3 2013-04-15 02:48:32 ServerA 72
4 2013-04-15 02:49:02 ServerA 72
5 2013-04-15 02:49:32 ServerA 72
6 2013-04-15 02:50:02 ServerA 73
:
:
:
: