Rev. | 3186aadc71c4c589a22f7f7a6e9d150bfd7a56d5 |
---|---|
サイズ | 2,482 バイト |
日時 | 2024-01-25 20:36:16 |
作者 | Lorenzo Isella |
ログメッセージ | The expenditure year is 2022. |
---
output: word_document
---
```{r, scoreboard, echo=FALSE, eval=TRUE}
options( scipen = 16 )
options(tidyverse.quiet = TRUE)
suppressWarnings(suppressMessages(library(janitor)))
suppressWarnings(suppressMessages(library(viridis)))
suppressWarnings(suppressMessages(library(scales)))
suppressWarnings(suppressMessages(library(treemap)))
suppressWarnings(suppressMessages(library(flextable)))
library(tidyverse, warn.conflicts = FALSE)
library(janitor)
library(viridis)
library(scales)
library(treemap)
library(stringi)
library(flextable)
source("/home/lorenzo/myprojects-hg/R-codes/stat_lib.R")
## pattern_to_pattern <- function(df, pattern1, pattern2){
## res <- df %>% replace(.,.== pattern1, pattern2)
## return(res)
## }
## ## this works also for a partial match
## search_replace <- function(df, pattern_search, pattern_replace){
## x <- df %>%
## mutate(across(where(is.character),
## stringr::str_replace_all, pattern = pattern_search,
## replacement = pattern_replace))
## }
out_list <- readRDS("list_annex_II.RDS")
my_title <- state
df <- out_list[[2]] |>
filter(scoreboard_objective==my_title) |>
select(member_state,case_no, working_title, amount_spent_aid_element_in_eur_million) |>
mutate(amount_spent_aid_element_in_eur_million=round(amount_spent_aid_element_in_eur_million,2)) |>
search_replace("_x000D_","") |>
search_replace("Plan d’évaluation pour", "") |>
search_replace("Plan d’évaluation", "") |>
search_replace("Evaluation plan for the", "") |>
search_replace("Evaluation plan for", "") |>
search_replace("Evaluation plan", "") |>
search_replace("plan d’évaluation", "") |>
search_replace("evaluation plan", "")
```
---
title: "`r my_title`"
---
```{r, table1, echo=FALSE, eval=TRUE}
df |>
flextable() |>
## add_header_row(values = c("some measures", "other measures") )%>%
set_header_labels(member_state="Member State",
case_no="SA Number",
working_title="Working Title",
amount_spent_aid_element_in_eur_million="Expenditure 2022 (aid element) in EUR million"
) |>
theme_zebra() |>
fontsize(part = "all", size = 8) |>
font(part="all", fontname = "Verdana") |>
colformat_double(big.mark = " ") |>
## autofit() ## %>%
width(width = c(1,1,3,1))
```