• R/O
  • SSH

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

File Info

Rev. dabe4ae68e3c7052a9b528f09399c9dc10995b3f
크기 5,404 bytes
Time 2024-06-11 20:12:19
Author Lorenzo Isella
Log Message

A quarto file with table and plots and references and all the captions are on top.

Content

---
format:
  docx:
    toc: false
    number-sections: true
    highlight-style: github
execute:
  echo: false
  warning: false
  message: false
fig-cap-location: top
---


```{r, scoreboard, echo=FALSE, eval=TRUE}

library(tidyverse, warn.conflicts = FALSE)
library(viridis)
library(flextable)


year_focus <- 2022

stat_cases <- structure(list(procedure_name = c("Agriculture Block Exemption Regulation", 
"Fisheries Block Exemption Regulation", "General Block Exemption Regulation", 
"Notified Aid", "Total"), n = c(38L, 3L, 251L, 47L, 339L), percent = c("11.2%", 
"0.9%", "74.0%", "13.9%", "100.0%")), row.names = c(NA, -5L), class = c("tbl_df", 
"tbl", "data.frame"), core = structure(list(procedure_name = c("Agriculture Block Exemption Regulation", 
"Fisheries Block Exemption Regulation", "General Block Exemption Regulation", 
"Notified Aid"), n = c(38L, 3L, 251L, 47L), percent = c(11.2, 
0.9, 74, 13.9)), row.names = c(NA, -4L), class = "data.frame"), tabyl_type = "two_way", totals = "row")



stat_cases2 <- structure(list(year = c(2012, 2012, 2012, 2013, 2013, 2013, 2014, 
2014, 2014, 2015, 2015, 2015, 2016, 2016, 2016, 2017, 2017, 2017, 
2018, 2018, 2018, 2019, 2019, 2019, 2020, 2020, 2020, 2021, 2021, 
2021, 2022, 2022, 2022), procedure_name = c("Agriculture Block Exemption Regulation", 
"General Block Exemption Regulation", "Notified Aid", "Agriculture Block Exemption Regulation", 
"General Block Exemption Regulation", "Notified Aid", "Agriculture Block Exemption Regulation", 
"General Block Exemption Regulation", "Notified Aid", "Agriculture Block Exemption Regulation", 
"General Block Exemption Regulation", "Notified Aid", "Agriculture Block Exemption Regulation", 
"General Block Exemption Regulation", "Notified Aid", "Agriculture Block Exemption Regulation", 
"General Block Exemption Regulation", "Notified Aid", "Agriculture Block Exemption Regulation", 
"General Block Exemption Regulation", "Notified Aid", "Agriculture Block Exemption Regulation", 
"General Block Exemption Regulation", "Notified Aid", "Agriculture Block Exemption Regulation", 
"General Block Exemption Regulation", "Notified Aid", "Agriculture Block Exemption Regulation", 
"General Block Exemption Regulation", "Notified Aid", "Agriculture Block Exemption Regulation", 
"General Block Exemption Regulation", "Notified Aid"), expenditure = c(0.031341, 
0.772735, 1.0506364, 0.031725, 0.672124, 1.1587967, 0.027114, 
0.395669, 1.0655565, 0.023264, 0.910199, 0.9733338, 0.132403, 
0.9334881, 0.9164271, 0.1159009, 0.9422837, 0.8899091, 0.1342904, 
1.0357514, 0.7333295, 0.1724899, 1.1234719, 0.7128631, 0.1892858, 
1.265574, 6.1494719, 0.1930364, 1.2223709, 8.573606, 0.207672, 
1.2500287, 5.0596376), expenditure_deflated = c(0.040544631307, 
0.999657179817, 1.359167399796, 0.040209125481, 0.851868187541, 
1.468690367567, 0.033474074075, 0.488480246886, 1.315501851829, 
0.027961538464, 1.09398918266, 1.169872355741, 0.155768235294, 
1.098221294133, 1.078149529462, 0.134611962827, 1.094406155676, 
1.033576190453, 0.152602727269, 1.176990227258, 0.83332897725, 
0.192511049105, 1.253874888393, 0.795606138384, 0.205076706392, 
1.371152762738, 6.662483098824, 0.204487711868, 1.29488442799, 
9.082209745624, 0.207672, 1.2500287, 5.0596376)), class = c("tbl_df", 
"tbl", "data.frame"), row.names = c(NA, -33L))

my_pal <- viridis(4)

```

---
title: "Country Focus on this and that"
---


Reference @tbl-tab1

```{r}
#| label: tbl-tab1
#| tbl-cap: "Caption 2"
library(flextable)
stat_cases |> 
    flextable()  |> 
    ## add_header_row(values = c(paste("State Aid Measures in ", year_focus, sep="")) ) %>%
    set_header_labels(procedure_name="Type of Procedure",
                      n="Number of Active Measures",
                      percent="Share of Total"
                      )  |> 
    theme_zebra()  |> 
    fontsize(part = "all", size = 8)  |> 
    font(part="all", fontname = "Verdana")  |> 
    colformat_double(big.mark = " ")  |> 
    ## autofit() ## %>%
    width(width = c(2,2,2))  |>
    add_header_row(
      values = paste("State Aid Measures in ",year_focus, sep=""),
      colwidths = c(3)) |>
    theme_box()  |> 
    align(align="center", part="header") |> 
    align(align = "right",j=c(2,3), part="body") 

```




I would like the table above to be numbered, to show its caption and I
would like to be able to reference it as Table xxx where xxx is the
table number.

```{r fig.height = 6, fig.width = 12}
#| label: fig-airquality
#| fig-cap: "State aid expenditure at constant prices."
#| warning: false

ggplot(data = stat_cases2, aes(x  = year, y=expenditure_deflated,
                                      fill=procedure_name)) +
    geom_bar(position=position_dodge2(preserve="single"), stat="identity", alpha=1, color="black")+
    scale_fill_manual(NULL,   values=my_pal)+
    labs(title=paste("State aid spending in billion EUR "))+
    xlab(NULL)+
    ylab("State aid expenditure (EUR bn)")+
    guides(fill=guide_legend(## nrow=1,byrow=TRUE,
                             position="top"))
```

@fig-airquality further explores the impact of temperature on ozone level.


Also, I would like the plot above to be numbered and to reference it
as Figure yyy where yyy is the plot number.

Finally, for both the plot and the table, I would like to have the
caption on top.

Last but not least, can I choose the font type (e.g. verdana) for the
whole document?