Я пытаюсь использовать keep
или discard
из пакета purrr
для фильтрации некоторого списка по двум условиям. То есть с данными, приведенными ниже, я хотел бы отфильтровать p.value
, когда оно равно < 0.060
и > 0.050
.
. Применение следующего, очевидно, не работает keep(d, ~.x$p.value > 0.05 & ~.x$p.value < 0.10)
.
Данные:
d <- list(ABMD = structure(list(statistic = c(`Dickey-Fuller` = -2.88823930907752),
parameter = c(`Lag order` = 3), alternative = "stationary",
p.value = 0.222153876057991, method = "Augmented Dickey-Fuller Test",
data.name = "Cl(.)"), class = "htest"), ATVI = structure(list(
statistic = c(`Dickey-Fuller` = -2.86560166108736), parameter = c(`Lag order` = 3),
alternative = "stationary", p.value = 0.231115731952747,
method = "Augmented Dickey-Fuller Test", data.name = "Cl(.)"), class = "htest"),
ADBE = structure(list(statistic = c(`Dickey-Fuller` = -2.91292875187715),
parameter = c(`Lag order` = 3), alternative = "stationary",
p.value = 0.212379749850693, method = "Augmented Dickey-Fuller Test",
data.name = "Cl(.)"), class = "htest"), AMD = structure(list(
statistic = c(`Dickey-Fuller` = -3.46654255102478), parameter = c(`Lag order` = 3),
alternative = "stationary", p.value = 0.0592779965240372,
method = "Augmented Dickey-Fuller Test", data.name = "Cl(.)"), class = "htest"),
AKAM = structure(list(statistic = c(`Dickey-Fuller` = -3.67846516682619),
parameter = c(`Lag order` = 3), alternative = "stationary",
p.value = 0.0380202892654308, method = "Augmented Dickey-Fuller Test",
data.name = "Cl(.)"), class = "htest"), ALXN = structure(list(
statistic = c(`Dickey-Fuller` = -2.93110833009175), parameter = c(`Lag order` = 3),
alternative = "stationary", p.value = 0.205182767184581,
method = "Augmented Dickey-Fuller Test", data.name = "Cl(.)"), class = "htest"))