我有一个包含小数秒时间戳的数据框。每秒有不止一行,我想过滤到一行。我想在每秒的顶部或之前提取值。
以下是数据示例:
> head(sg1, 13)
time count
1 2013-02-25 15:55:35.941 0
2 2013-02-25 15:55:36.042 8263
3 2013-02-25 15:55:36.144 147536
4 2013-02-25 15:55:36.243 165041
5 2013-02-25 15:55:36.342 126064
6 2013-02-25 15:55:36.441 100275
7 2013-02-25 15:55:36.542 101944
8 2013-02-25 15:55:36.647 108880
9 2013-02-25 15:55:36.742 86690
10 2013-02-25 15:55:36.842 74476
11 2013-02-25 15:55:36.941 76285
12 2013-02-25 15:55:37.042 79145
13 2013-02-25 15:55:37.141 84434
其中,我想选择第 1 行和第 11 行。
> dput(head(sg1, 13))
structure(list(time = structure(c(1361807735.942, 1361807736.042,
1361807736.145, 1361807736.244, 1361807736.343, 1361807736.442,
1361807736.542, 1361807736.647, 1361807736.742, 1361807736.842,
1361807736.942, 1361807737.042, 1361807737.142), class = c("POSIXct",
"POSIXt"), tzone = "GMT"), count = c(0L, 8263L, 147536L, 165041L,
126064L, 100275L, 101944L, 108880L, 86690L, 74476L, 76285L, 79145L,
84434L)), .Names = c("time", "count"), row.names = c(NA, 13L), class = "data.frame")