我有这个列表列表:
df.list <- list(`2023-02-15_10-30-49` = list(V4 = c(5019.00214, 5019.00215,
5019.00216, 5019.00217, 5019.00218, 5019.00214, 5019.00215, 5019.00215,
5019.00215, 5019.00215, 5019.00215, 5019.00215, 5019.00214, 5019.00214
), V6 = c(500.86491, 500.86495, 500.86497, 500.86498, 500.86499,
500.86375, 500.86374, 500.86372, 500.86372, 500.86372, 500.86373,
500.86372, 500.86373, 500.86372), V8 = c(235.314, 235.423, 235.502,
235.556, 235.606, 230.496, 230.502, 230.561, 230.556, 230.553,
230.564, 230.555, 230.59, 230.598), V10 = c(0.38, 0.37, 0.37,
0.37, 0.36, 0.037, 0.025, 0.014, 0.014, 0.014, 0.014, 0.014,
0.014, 0.014), V11 = c(0.75, 0.73, 0.71, 0.7, 0.69, 0.056, 0.04,
0.017, 0.015, 0.015, 0.015, 0.015, 0.014, 0.015)), `2023-02-15_10-33-16` = list(
V4 = c(5019.00198, 5019.00194, 5019.00193, 5019.00193, 5019.00216,
5019.00194, 5019.00194, 5019.00194, 5019.00194, 5019.00194,
5019.00194, 5019.00194, 5019.00194, 5019.00194, 5019.00194,
5019.00195, 5019.00195, 5019.00195), V6 = c(500.86428, 500.86419,
500.86421, 500.86423, 500.86392, 500.86343, 500.86341, 500.86341,
500.86342, 500.86342, 500.86342, 500.86342, 500.86342, 500.86342,
500.86342, 500.86344, 500.86343, 500.86343), V8 = c(233.154,
233.162, 233.155, 233.142, 230.303, 230.491, 230.464, 230.457,
230.466, 230.474, 230.472, 230.482, 230.479, 230.476, 230.488,
230.496, 230.497, 230.499), V10 = c(0.37, 0.37, 0.37, 0.37,
1.2, 0.014, 0.014, 0.014, 0.014, 0.014, 0.014, 0.014, 0.015,
0.015, 0.014, 0.014, 0.014, 0.014), V11 = c(0.6, 0.6, 0.6,
0.6, 0.82, 0.017, 0.017, 0.019, 0.021, 0.021, 0.022, 0.022,
0.024, 0.023, 0.021, 0.019, 0.018, 0.019)), `2023-02-15_10-33-46` = list(
V4 = c(5019.00175, 5019.00175, 5019.00175, 5019.00175, 5019.00175,
5019.00174, 5019.00175, 5019.00175, 5019.00175, 5019.00174,
5019.00173, 5019.00173), V6 = c(500.86318, 500.86319, 500.86318,
500.86318, 500.86318, 500.86318, 500.86315, 500.86315, 500.86315,
500.86315, 500.86313, 500.86312), V8 = c(230.518, 230.525,
230.514, 230.515, 230.531, 230.539, 230.507, 230.506, 230.509,
230.513, 230.502, 230.486), V10 = c(0.016, 0.018, 0.018,
0.019, 0.021, 0.098, 0.015, 0.014, 0.014, 0.014, 0.014, 0.014
), V11 = c(0.023, 0.026, 0.028, 0.029, 0.035, 0.15, 0.024,
0.022, 0.021, 0.019, 0.02, 0.022)))
我想用一个阈值来过滤列表,并将输出作为 Dataframe 或列表的列表。为此,我使用了以下代码:
df.list <- lapply(df.list, function(i) filter(i, V10 <= 0.025))
不幸的是,当我应用这个代码时,我得到了这个错误消息:
Error in UseMethod("filter") :
no applicable method for 'filter' applied to an object of class "list"
3条答案
按热度按时间kq4fsx7k1#
您有一个列表列表,需要将其转换为 Dataframe 列表。使用
purrr
和dplyr
,我们可以执行以下操作:lf5gs5x22#
也许我们可以尝试嵌套
lapply
它给出了
vd8tlhqk3#
试试看