Revisión | 6cf0f5ce836f3c81837f40f64e319fe681625ffb (tree) |
---|---|
Tiempo | 2023-01-28 04:07:45 |
Autor | Lorenzo Isella <lorenzo.isella@gmai...> |
Commiter | Lorenzo Isella |
Small modifications for the new dplyr release + possibility to exclude more than 1 country.
@@ -13,6 +13,8 @@ | ||
13 | 13 | |
14 | 14 | tidymodels_prefer() |
15 | 15 | |
16 | +'%!in%' <- function(x,y)!('%in%'(x,y)) | |
17 | + | |
16 | 18 | |
17 | 19 | |
18 | 20 |
@@ -86,13 +88,28 @@ | ||
86 | 88 | } |
87 | 89 | |
88 | 90 | |
91 | +## pattern_to_na <- function(df, pattern){ | |
92 | + | |
93 | +## ## res <- df %>% na_if(., pattern) | |
94 | + | |
95 | +## res <- df |> (\(x) na_if(x, pattern))() | |
96 | + | |
97 | + | |
98 | + | |
99 | +## return(res) | |
100 | + | |
101 | +## } | |
102 | + | |
89 | 103 | pattern_to_na <- function(df, pattern){ |
90 | 104 | |
91 | 105 | ## res <- df %>% na_if(., pattern) |
92 | 106 | |
93 | -res <- df |> (\(x) na_if(x, pattern))() | |
107 | +## res <- df |> (\(x) na_if(x, pattern))() | |
94 | 108 | |
95 | - | |
109 | +## across(where(is.character), \(x) na_if(x, "D")) | |
110 | + | |
111 | + res <- df |> | |
112 | + mutate(across(where(is.character), \(x) na_if(x, pattern))) | |
96 | 113 | |
97 | 114 | return(res) |
98 | 115 |
@@ -144,7 +161,7 @@ | ||
144 | 161 | rename("value"="obs_value", |
145 | 162 | "date"="time_period") |> |
146 | 163 | filter(geo %in% iso_map_eu27$iso2, |
147 | - geo!="MT") | |
164 | + geo %!in% c("MT", "ES")) | |
148 | 165 | |
149 | 166 | ms_list <- price_series |> |
150 | 167 | pull(geo) |> |