• R/O
  • SSH

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Revisioned96674ff71adc2d4830b2864b3e9b6216a8ccfb (tree)
Zeit2021-10-12 00:25:23
AutorLorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Log Message

I am transitioning the code from PDF to word tables. Check carefully!

Ändern Zusammenfassung

Diff

diff -r 050723f404e6 -r ed96674ff71a R-codes/process_covid_tracker.R
--- a/R-codes/process_covid_tracker.R Mon Oct 11 15:28:33 2021 +0200
+++ b/R-codes/process_covid_tracker.R Mon Oct 11 17:25:23 2021 +0200
@@ -1,6 +1,6 @@
11 rm(list=ls())
22
3-## last saved on Time-stamp: "2021-10-11 12:53:20 lorenzo"
3+## last saved on Time-stamp: "2021-10-11 17:19:09 lorenzo"
44
55
66 library(tidyverse)
@@ -11,6 +11,8 @@
1111 library(formattable)
1212 library(stringi)
1313 library(kableExtra)
14+library(huxtable)
15+library(flextable)
1416
1517 source("/home/lorenzo/myprojects-hg/R-codes/stat_lib.R")
1618
@@ -41,7 +43,7 @@
4143 year_focus <- c(2019,2020,2021)
4244
4345
44-pdf_generation <- 1 ## whether I should generate the pdf files or not
46+table_generation <- 1 ## whether I should generate the pdf files or not
4547
4648 names <- tibble(iso2= c("AT", "BE", "BG" ,
4749 "CY" , "CZ" , "DE",
@@ -293,7 +295,8 @@
293295 filter(complete.cases(.)) %>%
294296 mutate(share=budget/sum(budget)) %>%
295297 arrange(desc(budget))%>%
296- add_total(nrow(.)+1)
298+ add_total(nrow(.)+1) %>%
299+ filter(beneficary_sector!=" ", beneficary_sector!=0)
297300
298301
299302 ### budget broken by MS and beneficiary sector
@@ -323,7 +326,9 @@
323326 filter(complete.cases(.)) %>%
324327 mutate(share=budget/sum(budget)) %>%
325328 arrange(desc(budget))%>%
326- add_total(nrow(.)+1)
329+ add_total(nrow(.)+1)%>%
330+ filter(beneficary_type!=" ", beneficary_type!=0)
331+
327332
328333
329334
@@ -1244,7 +1249,7 @@
12441249 ##########################################################################
12451250 ##########################################################################
12461251
1247-if (pdf_generation==1){
1252+if (table_generation==1){
12481253
12491254 ###Now I generate some table
12501255
@@ -1260,84 +1265,136 @@
12601265
12611266 t1 <- budget_test %>%
12621267 left_join(gdp, by=c("member_state_2_letter_code"="country")) %>%
1263- mutate(gdp=budget/gdp*100) %>%
1264- mutate(gdp=format_col(gdp,1)) %>%
1268+ mutate(gdp=budget/gdp## *100
1269+ ) %>%
1270+ ## mutate(gdp=format_col(gdp,1)) %>%
12651271 left_join(y=decisions_test) %>%
12661272 left_join(y=count_am, by=c("member_state_2_letter_code"="member_state_of_amendment")) %>%
12671273 left_join(y=temp2, by=c("member_state_2_letter_code"))
12681274
12691275
1270-t1_plot <- t1 %>%
1271- mutate(share=share*100) %>%
1272- mutate(budget=format_col(budget,1)) %>%
1273- mutate(share=round(share,1)) %>%
1274- mutate(share=format_col(share,1)) %>%
1275- mutate(share=paste(share,"%", sep="")) %>%
1276- mutate(gdp=paste(gdp,"%", sep="")) %>%
1277- mutate(mean_duration=format_col(mean_duration,1),
1278- median_duration=format_col(median_duration,1)
1279- ) %>%
1280- left_join(y=names, by=c("member_state_2_letter_code"="iso2")) %>%
1281- select(-member_state_2_letter_code) %>%
1282- select(country, everything())
1283-
1284-
1285-
1286-
1287-nn <- linebreak( c("Member State",
1288- "Allocated Budget\n(Million EUR)", "Share of\nTotal",
1289- "Share of\nGDP",
1290- "Number of\nDecisions", "Number of\nAmendments",
1291- "Mean Duration\n(calendar days)", "Median Duration\n(calendar days)") ,
1292- align="c")
1293-
1294-
1295-
1296-ll <- t1_plot %>%
1297- search_replace( "%", "\\\\%" ) %>%
1298- ## na_char_to_pattern(":") %>%
1299- ## pattern_to_pattern("NA", ":") %>%
1300- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
1301- col.names = nn,
1302- caption = "EU Wide Statistics on Covid19 State Aid Measures"
1303- ) %>%
1304- kable_styling(latex_options = c("striped", "hold_position"),
1305- full_width = F## , font_size = 7
1306- ) %>%
1307- footnote(general=c(
1308- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
1309- threeparttable = T) ## %>%
1310- ## row_spec(pos, bold = T)
1311-
1312-
1313-
1314-
1315-
1316-writeLines(
1317- c(
1318- "\\documentclass{article}",
1319- "\\usepackage[a4paper, landscape]{geometry}",
1320- "\\usepackage{helvet}",
1321- "\\usepackage[flushleft]{threeparttable}" ,
1322- "\\usepackage{graphicx}",
1323- "\\renewcommand{\\familydefault}{\\sfdefault}",
1324- "\\usepackage{caption}",
1325- "\\usepackage[labelfont=bf,font=large]{caption}",
1326- "\\usepackage{makecell}",
1327- "\\usepackage{booktabs}",
1328-"\\usepackage{colortbl, xcolor}",
1329-"\\begin{document}",
1330-"\\thispagestyle{empty}",
1331-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
1332- ll,
1333- "\\end{document}"
1334- ),
1335- "table1.tex"
1336-)
1337-
1338-
1339-
1340-tools::texi2pdf("table1.tex", clean = TRUE)
1276+
1277+
1278+### If you want to use huxtable to generate the plots.
1279+
1280+## ht1 <- t1 %>%
1281+## mutate(budget=format_col(budget,1)) %>%
1282+## set_colnames(c("Member State",
1283+## "Allocated Budget (Million EUR)", "Share of Total",
1284+## "Share of GDP",
1285+## "Number of Decisions", "Number of Amendments",
1286+## "Mean Duration (calendar days)", "Median Duration (calendar days)")) %>%
1287+## as_hux() %>%
1288+## set_font_size(8) %>%
1289+## theme_grey( header_col = F) %>%
1290+## set_bold(everywhere,1) %>%
1291+## set_align(everywhere, 2, "right") %>%
1292+## set_width(1.35) %>%
1293+## set_number_format(everywhere, c(3,4), fmt_percent(2) ) %>%
1294+## set_number_format(everywhere, c(7,8), 1 )
1295+
1296+
1297+## quick_docx(ht1, file = "table1_hux.docx", open=F)
1298+
1299+
1300+
1301+
1302+ fl1 <- t1 %>% flextable() %>%
1303+ ## add_header_row(values = c("some measures", "other measures") )%>%
1304+ set_header_labels(member_state_2_letter_code="Member State",
1305+ budget="Allocated Budget (mio €)",
1306+ share="Share of Total",
1307+ gdp="Share of GDP",
1308+ n_decisions="Number of Decisions",
1309+ n_amendments="Number of Amendments",
1310+ mean_duration="Mean Duration (calendar days)",
1311+ median_duration="Median Duration (calendar days)") %>% bold(j = 1, bold = TRUE) %>%
1312+ theme_zebra() %>%
1313+ fontsize(part = "all", size = 8) %>%
1314+ font(part="all", fontname = "Verdana") %>%
1315+ colformat_double(big.mark = " ") %>%
1316+ set_formatter(share = function(x) sprintf( "%.1f%%", x*100 ) ) %>%
1317+ set_formatter(gdp = function(x) sprintf( "%.1f%%", x*100 ) ) %>%
1318+ ## width(width = 1.) %>%
1319+ FitFlextableToPage() %>%
1320+ set_caption(caption = "EU Wide Statistics on Covid19 State Aid Measures")
1321+
1322+ save_as_docx(fl1, path="table1_flex.docx" )
1323+
1324+
1325+## If I want to use kablextra to generate the plot.
1326+
1327+## nn <- linebreak( c("Member State",
1328+## "Allocated Budget\n(Million EUR)", "Share of\nTotal",
1329+## "Share of\nGDP",
1330+## "Number of\nDecisions", "Number of\nAmendments",
1331+## "Mean Duration\n(calendar days)", "Median Duration\n(calendar days)") ,
1332+## align="c")
1333+
1334+
1335+
1336+## t1_plot <- t1 %>%
1337+## mutate(share=share*100) %>%
1338+## mutate(budget=format_col(budget,1)) %>%
1339+## mutate(share=round(share,1)) %>%
1340+## mutate(share=format_col(share,1)) %>%
1341+## mutate(share=paste(share,"%", sep="")) %>%
1342+## mutate(gdp=paste(gdp,"%", sep="")) %>%
1343+## mutate(mean_duration=format_col(mean_duration,1),
1344+## median_duration=format_col(median_duration,1)
1345+## ) %>%
1346+## left_join(y=names, by=c("member_state_2_letter_code"="iso2")) %>%
1347+## select(-member_state_2_letter_code) %>%
1348+## select(country, everything())
1349+
1350+
1351+
1352+
1353+## ll <- t1_plot %>%
1354+## search_replace( "%", "\\\\%" ) %>%
1355+## ## na_char_to_pattern(":") %>%
1356+## ## pattern_to_pattern("NA", ":") %>%
1357+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
1358+## col.names = nn,
1359+## caption = "EU Wide Statistics on Covid19 State Aid Measures"
1360+## ) %>%
1361+## kable_styling(latex_options = c("striped", "hold_position"),
1362+## full_width = F## , font_size = 7
1363+## ) %>%
1364+## footnote(general=c(
1365+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
1366+## threeparttable = T) ## %>%
1367+## ## row_spec(pos, bold = T)
1368+
1369+
1370+
1371+
1372+
1373+## writeLines(
1374+## c(
1375+## "\\documentclass{article}",
1376+## "\\usepackage[a4paper, landscape]{geometry}",
1377+## "\\usepackage{helvet}",
1378+## "\\usepackage[flushleft]{threeparttable}" ,
1379+## "\\usepackage{graphicx}",
1380+## "\\renewcommand{\\familydefault}{\\sfdefault}",
1381+## "\\usepackage{caption}",
1382+## "\\usepackage[labelfont=bf,font=large]{caption}",
1383+## "\\usepackage{makecell}",
1384+## "\\usepackage{booktabs}",
1385+## "\\usepackage{colortbl, xcolor}",
1386+## "\\begin{document}",
1387+## "\\thispagestyle{empty}",
1388+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
1389+## ll,
1390+## "\\end{document}"
1391+## ),
1392+## "table1.tex"
1393+## )
1394+
1395+
1396+
1397+## tools::texi2pdf("table1.tex", clean = TRUE)
13411398
13421399 ###############################################################à
13431400 ###############################################################à
@@ -1349,69 +1406,98 @@
13491406
13501407 t1 <- budget_type %>%
13511408 select(name, budget, share) %>%
1352- mutate(share=share*100) %>%
1353- mutate(budget=format_col(budget, 1),
1354- share=format_col(share,2)) %>%
1355- mutate(share=paste(share, "%", sep="")) %>%
1409+ ## mutate(share=share*100) %>%
1410+ ## mutate(budget=format_col(budget, 1),
1411+ ## share=format_col(share,2)) %>%
1412+ ## mutate(share=paste(share, "%", sep="")) %>%
13561413 pattern_to_pattern("-", "Total EU")
13571414
13581415
13591416
1360-
1361-
1362-nn <- linebreak( c("Case Type",
1363- "Allocated Budget\n(Million EUR)", "Share of\nTotal"
1364- ) ,
1365- align="c")
1366-
1367-
1368-t1_plot <- t1
1369-
1370-ll <- t1_plot %>%
1371- search_replace( "%", "\\\\%" ) %>%
1372- na_to_pattern(":") %>%
1373- pattern_to_pattern("NA", ":") %>%
1374- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
1375- col.names = nn,
1376- caption = "Covid19 Allocated Budget by Case Type (Decided Cases)"
1377- ) %>%
1378- kable_styling(latex_options = c("striped", "hold_position"),
1379- full_width = F## , font_size = 7
1380- ) %>%
1381- footnote(general=c(
1382- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
1383- threeparttable = T) ## %>%
1384- ## row_spec(pos, bold = T)
1385-
1386-
1387-
1388-
1389-
1390-writeLines(
1391- c(
1392- "\\documentclass{article}",
1393- "\\usepackage[a4paper]{geometry}",
1394- "\\usepackage{helvet}",
1395- "\\usepackage[flushleft]{threeparttable}" ,
1396- "\\usepackage{graphicx}",
1397- "\\renewcommand{\\familydefault}{\\sfdefault}",
1398- "\\usepackage{caption}",
1399- "\\usepackage[labelfont=bf,font=large]{caption}",
1400- "\\usepackage{makecell}",
1401- "\\usepackage{booktabs}",
1402-"\\usepackage{colortbl, xcolor}",
1403-"\\begin{document}",
1404-"\\thispagestyle{empty}",
1405-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
1406- ll,
1407- "\\end{document}"
1408- ),
1409- "table2.tex"
1410-)
1411-
1412-
1413-
1414-tools::texi2pdf("table2.tex", clean = TRUE)
1417+ fl2 <- t1 %>% flextable() %>%
1418+ ## add_header_row(values = c("some measures", "other measures") )%>%
1419+ set_header_labels(name="Case Type",
1420+ budget="Allocated Budget (mio €)",
1421+ share="Share of Total") %>%
1422+ theme_zebra() %>%
1423+ bold(j = 1, bold = TRUE) %>%
1424+ fontsize(part = "all", size = 8) %>%
1425+ font(part="all", fontname = "Verdana") %>%
1426+ colformat_double(big.mark = " ") %>%
1427+ set_formatter(share = function(x) sprintf( "%.2f%%", x*100 ) ) %>%
1428+ ## set_formatter(gdp = function(x) sprintf( "%.1f%%", x*100 ) ) %>%
1429+ ## width(width = 1.) %>%
1430+ FitFlextableToPage() %>%
1431+ set_caption(caption = "Covid19 Allocated Budget by Case Type (Decided Cases)")
1432+
1433+
1434+ save_as_docx(fl2, path="table2_flex.docx" )
1435+
1436+
1437+
1438+## t1 <- budget_type %>%
1439+## select(name, budget, share) %>%
1440+## mutate(share=share*100) %>%
1441+## mutate(budget=format_col(budget, 1),
1442+## share=format_col(share,2)) %>%
1443+## mutate(share=paste(share, "%", sep="")) %>%
1444+## pattern_to_pattern("-", "Total EU")
1445+
1446+
1447+
1448+## nn <- linebreak( c("Case Type",
1449+## "Allocated Budget\n(Million EUR)", "Share of\nTotal"
1450+## ) ,
1451+## align="c")
1452+
1453+
1454+## t1_plot <- t1
1455+
1456+## ll <- t1_plot %>%
1457+## search_replace( "%", "\\\\%" ) %>%
1458+## na_to_pattern(":") %>%
1459+## pattern_to_pattern("NA", ":") %>%
1460+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
1461+## col.names = nn,
1462+## caption = "Covid19 Allocated Budget by Case Type (Decided Cases)"
1463+## ) %>%
1464+## kable_styling(latex_options = c("striped", "hold_position"),
1465+## full_width = F## , font_size = 7
1466+## ) %>%
1467+## footnote(general=c(
1468+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
1469+## threeparttable = T) ## %>%
1470+## ## row_spec(pos, bold = T)
1471+
1472+
1473+
1474+
1475+
1476+## writeLines(
1477+## c(
1478+## "\\documentclass{article}",
1479+## "\\usepackage[a4paper]{geometry}",
1480+## "\\usepackage{helvet}",
1481+## "\\usepackage[flushleft]{threeparttable}" ,
1482+## "\\usepackage{graphicx}",
1483+## "\\renewcommand{\\familydefault}{\\sfdefault}",
1484+## "\\usepackage{caption}",
1485+## "\\usepackage[labelfont=bf,font=large]{caption}",
1486+## "\\usepackage{makecell}",
1487+## "\\usepackage{booktabs}",
1488+## "\\usepackage{colortbl, xcolor}",
1489+## "\\begin{document}",
1490+## "\\thispagestyle{empty}",
1491+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
1492+## ll,
1493+## "\\end{document}"
1494+## ),
1495+## "table2.tex"
1496+## )
1497+
1498+
1499+
1500+## tools::texi2pdf("table2.tex", clean = TRUE)
14151501
14161502
14171503
@@ -1422,79 +1508,119 @@
14221508
14231509 ## Another table
14241510
1425-t1 <- budget_measure %>%
1426- arrange(desc(budget)) %>%
1427- mutate(share=share*100) %>%
1428- mutate(budget=format_col(budget, 1),
1429- share=format_col(share,2)) %>%
1430- mutate(share=paste(share, "%", sep="")) %>%
1431- move_row(1, nrow(.)) %>%
1432- mutate(type_of_measure=wrapper_text(type_of_measure,65))
1433-
1434-## t1 <- t1 %>%
1435-## bind_rows(t1)
1436-
1437-
1438-
1439-
1440-nn <- linebreak( c("Measure",
1441- "Allocated Budget\n(Million EUR)", "Share of\nTotal"
1442- ) ,
1443- align="c")
1444-
1445-
1446-t1_plot <- t1
1447-
1448-ll <- t1_plot %>%
1449- search_replace( "%", "\\\\%" ) %>%
1450- search_replace( "&", "\\\\&" ) %>%
1451- na_to_pattern(":") %>%
1452- pattern_to_pattern("NA", ":") %>%
1453-
1454- ## kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",6)),
1511+
14551512
14561513
1457- kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",2)),
1458- col.names = nn,
1459- caption = "Covid19 Allocated Budget by Type of Measure (Decided Cases)"
1460- ) %>%
1461- kable_styling( position = "center",
1462- latex_options = c("repeat_header","striped" , "hold_position"),
1463- full_width = F) %>%
1464- footnote(general=c(
1465- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE) ## %>%
1466- ## row_spec(pos, bold = T)
1467-
1468-
1469-
1470-writeLines(
1471- c(
1472- "\\documentclass{article}",
1473- "\\usepackage[a4paper]{geometry}",
1474- "\\usepackage{longtable}",
1475- "\\usepackage{helvet}",
1476- "\\usepackage[flushleft]{threeparttable}" ,
1477- "\\usepackage{graphicx}",
1478- "\\usepackage{eurosym}",
1479- "\\renewcommand{\\familydefault}{\\sfdefault}",
1480- "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
1481- "\\usepackage{makecell}",
1482- "\\usepackage{booktabs}",
1483-"\\usepackage{colortbl, xcolor}",
1484-"\\begin{document}",
1485-"\\pagestyle{empty}",
1486-"\\setlength{\\LTleft}{-20cm plus -1fill}",
1487-"\\setlength{\\LTright}{\\LTleft}",
1488-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
1489- ll,
1490- "\\end{document}"
1491- ),
1492- "table3.tex"
1493-)
1494-
1495-
1496-
1497-tools::texi2pdf("table3.tex", clean = TRUE)
1514+t1 <- budget_measure %>%
1515+ arrange(desc(budget))
1516+
1517+
1518+ fl3 <- t1 %>% flextable() %>%
1519+ ## add_header_row(values = c("some measures", "other measures") )%>%
1520+ set_header_labels(type_of_measure="Measure",
1521+ budget="Allocated Budget (mio €)",
1522+ share="Share of Total") %>%
1523+ theme_zebra() %>%
1524+ bold(j = 1, bold = TRUE) %>%
1525+ fontsize(part = "all", size = 8) %>%
1526+ font(part="all", fontname = "Verdana") %>%
1527+ colformat_double(big.mark = " ") %>%
1528+ set_formatter(share = function(x) sprintf( "%.2f%%", x*100 ) ) %>%
1529+ ## set_formatter(gdp = function(x) sprintf( "%.1f%%", x*100 ) ) %>%
1530+ ## width(width = 1.7) %>%
1531+ FitFlextableToPage() %>%
1532+ set_caption(caption = "Covid19 Allocated Budget by Case Type (Decided Cases)")
1533+
1534+
1535+
1536+ save_as_docx(fl3, path="table3_flex.docx" )
1537+
1538+
1539+
1540+
1541+
1542+ ## %>%
1543+ ## mutate(share=share*100) %>%
1544+ ## mutate(budget=format_col(budget, 1),
1545+ ## share=format_col(share,2)) %>%
1546+ ## mutate(share=paste(share, "%", sep="")) %>%
1547+ ## move_row(1, nrow(.)) %>%
1548+ ## mutate(type_of_measure=wrapper_text(type_of_measure,65))
1549+
1550+
1551+## t1 <- budget_measure %>%
1552+## arrange(desc(budget)) %>%
1553+## mutate(share=share*100) %>%
1554+## mutate(budget=format_col(budget, 1),
1555+## share=format_col(share,2)) %>%
1556+## mutate(share=paste(share, "%", sep="")) %>%
1557+## move_row(1, nrow(.)) %>%
1558+## mutate(type_of_measure=wrapper_text(type_of_measure,65))
1559+
1560+## ## t1 <- t1 %>%
1561+## ## bind_rows(t1)
1562+
1563+
1564+
1565+
1566+## nn <- linebreak( c("Measure",
1567+## "Allocated Budget\n(Million EUR)", "Share of\nTotal"
1568+## ) ,
1569+## align="c")
1570+
1571+
1572+## t1_plot <- t1
1573+
1574+## ll <- t1_plot %>%
1575+## search_replace( "%", "\\\\%" ) %>%
1576+## search_replace( "&", "\\\\&" ) %>%
1577+## na_to_pattern(":") %>%
1578+## pattern_to_pattern("NA", ":") %>%
1579+
1580+## ## kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",6)),
1581+
1582+
1583+## kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",2)),
1584+## col.names = nn,
1585+## caption = "Covid19 Allocated Budget by Type of Measure (Decided Cases)"
1586+## ) %>%
1587+## kable_styling( position = "center",
1588+## latex_options = c("repeat_header","striped" , "hold_position"),
1589+## full_width = F) %>%
1590+## footnote(general=c(
1591+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE) ## %>%
1592+## ## row_spec(pos, bold = T)
1593+
1594+
1595+
1596+## writeLines(
1597+## c(
1598+## "\\documentclass{article}",
1599+## "\\usepackage[a4paper]{geometry}",
1600+## "\\usepackage{longtable}",
1601+## "\\usepackage{helvet}",
1602+## "\\usepackage[flushleft]{threeparttable}" ,
1603+## "\\usepackage{graphicx}",
1604+## "\\usepackage{eurosym}",
1605+## "\\renewcommand{\\familydefault}{\\sfdefault}",
1606+## "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
1607+## "\\usepackage{makecell}",
1608+## "\\usepackage{booktabs}",
1609+## "\\usepackage{colortbl, xcolor}",
1610+## "\\begin{document}",
1611+## "\\pagestyle{empty}",
1612+## "\\setlength{\\LTleft}{-20cm plus -1fill}",
1613+## "\\setlength{\\LTright}{\\LTleft}",
1614+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
1615+## ll,
1616+## "\\end{document}"
1617+## ),
1618+## "table3.tex"
1619+## )
1620+
1621+
1622+
1623+## tools::texi2pdf("table3.tex", clean = TRUE)
14981624
14991625
15001626
@@ -1504,139 +1630,208 @@
15041630 #####################################################################
15051631
15061632
1507-t1 <- decisions_eu %>%
1508- mutate(share=share*100) %>%
1509- mutate(
1510- share=format_col(share,2)) %>%
1511- mutate(share=paste(share, "%", sep=""))
1512-
1513-
1514-
1515-nn <- linebreak( c("Legal Basis",
1516- "Number of\nDecisions", "Share of\nTotal"
1517- ) ,
1518- align="c")
1519-
1520-
1521-t1_plot <- t1
1522-
1523-ll <- t1_plot %>%
1524- search_replace( "%", "\\\\%" ) %>%
1525- search_replace( "&", "\\\\&" ) %>%
1526- na_to_pattern(":") %>%
1527- pattern_to_pattern("NA", ":") %>%
1528- pattern_to_pattern("NA", ":") %>%
1529- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
1530- col.names = nn,
1531- caption = "Covid19 Decisions by Legal Basis (Decided Cases)"
1532- ) %>%
1533- kable_styling(latex_options = c("striped", "hold_position"),
1534- full_width = F## , font_size = 7
1535- ) %>%
1536- footnote(general=c(
1537- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
1538- threeparttable = T) ## %>%
1539- ## row_spec(pos, bold = T)
1540-
1541-
1542-
1543-
1544-
1545-writeLines(
1546- c(
1547- "\\documentclass{article}",
1548- "\\usepackage[a4paper]{geometry}",
1549- "\\usepackage{helvet}",
1550- "\\usepackage[flushleft]{threeparttable}" ,
1551- "\\usepackage{graphicx}",
1552- "\\renewcommand{\\familydefault}{\\sfdefault}",
1553- "\\usepackage{caption}",
1554- "\\usepackage[labelfont=bf,font=large]{caption}",
1555- "\\usepackage{makecell}",
1556- "\\usepackage{booktabs}",
1557-"\\usepackage{colortbl, xcolor}",
1558-"\\begin{document}",
1559-"\\thispagestyle{empty}",
1560-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
1561- ll,
1562- "\\end{document}"
1563- ),
1564- "table4.tex"
1565-)
1566-
1567-
1568-
1569-tools::texi2pdf("table4.tex", clean = TRUE)
1633+ t1 <- decisions_eu %>%
1634+ mutate(share=round_preserve_sum(share,4))
1635+
1636+ ## %>%
1637+ ## mutate(share=share*100) %>%
1638+ ## mutate(
1639+ ## share=format_col(share,2)) %>%
1640+ ## mutate(share=paste(share, "%", sep=""))
1641+
1642+
1643+
1644+ fl4 <- t1 %>% flextable() %>%
1645+ ## add_header_row(values = c("some measures", "other measures") )%>%
1646+ set_header_labels(legal_basis="Legal Basis",
1647+ n_decisions="Number of Decisions",
1648+ share="Share of Total") %>%
1649+ theme_zebra() %>%
1650+ bold(j = 1, bold = TRUE) %>%
1651+ fontsize(part = "all", size = 8) %>%
1652+ font(part="all", fontname = "Verdana") %>%
1653+ colformat_double(big.mark = " ") %>%
1654+ set_formatter(share = function(x) sprintf( "%.2f%%", x*100 ) ) %>%
1655+ ## set_formatter(gdp = function(x) sprintf( "%.1f%%", x*100 ) ) %>%
1656+ ## width(width = 1.7) %>%
1657+ FitFlextableToPage() %>%
1658+ set_caption(caption = "Covid19 Decisions by Legal Basis (Decided Cases)")
1659+
1660+
1661+
1662+ save_as_docx(fl4, path="table4_flex.docx" )
1663+
1664+
1665+
1666+
1667+## t1 <- decisions_eu %>%
1668+## mutate(share=share*100) %>%
1669+## mutate(
1670+## share=format_col(share,2)) %>%
1671+## mutate(share=paste(share, "%", sep=""))
1672+
1673+
1674+
1675+## nn <- linebreak( c("Legal Basis",
1676+## "Number of\nDecisions", "Share of\nTotal"
1677+## ) ,
1678+## align="c")
1679+
1680+
1681+## t1_plot <- t1
1682+
1683+## ll <- t1_plot %>%
1684+## search_replace( "%", "\\\\%" ) %>%
1685+## search_replace( "&", "\\\\&" ) %>%
1686+## na_to_pattern(":") %>%
1687+## pattern_to_pattern("NA", ":") %>%
1688+## pattern_to_pattern("NA", ":") %>%
1689+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
1690+## col.names = nn,
1691+## caption = "Covid19 Decisions by Legal Basis (Decided Cases)"
1692+## ) %>%
1693+## kable_styling(latex_options = c("striped", "hold_position"),
1694+## full_width = F## , font_size = 7
1695+## ) %>%
1696+## footnote(general=c(
1697+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
1698+## threeparttable = T) ## %>%
1699+## ## row_spec(pos, bold = T)
1700+
1701+
1702+
1703+
1704+
1705+## writeLines(
1706+## c(
1707+## "\\documentclass{article}",
1708+## "\\usepackage[a4paper]{geometry}",
1709+## "\\usepackage{helvet}",
1710+## "\\usepackage[flushleft]{threeparttable}" ,
1711+## "\\usepackage{graphicx}",
1712+## "\\renewcommand{\\familydefault}{\\sfdefault}",
1713+## "\\usepackage{caption}",
1714+## "\\usepackage[labelfont=bf,font=large]{caption}",
1715+## "\\usepackage{makecell}",
1716+## "\\usepackage{booktabs}",
1717+## "\\usepackage{colortbl, xcolor}",
1718+## "\\begin{document}",
1719+## "\\thispagestyle{empty}",
1720+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
1721+## ll,
1722+## "\\end{document}"
1723+## ),
1724+## "table4.tex"
1725+## )
1726+
1727+
1728+
1729+## tools::texi2pdf("table4.tex", clean = TRUE)
15701730
15711731 ###########################################################################
15721732 ###########################################################################
15731733 ###########################################################################
15741734
15751735
1576-
1577-t1 <- measures_covid %>%
1578- mutate(share=share*100) %>%
1579- mutate(
1580- share=format_col(share,2)) %>%
1581- mutate(share=paste(share, "%", sep=""))
1582-
1583-
1584-
1585-nn <- linebreak( c("Legal Basis",
1586- "Number of\nMeasures", "Share of\nTotal"
1587- ) ,
1588- align="c")
1589-
1590-
1591-t1_plot <- t1
1592-
1593-ll <- t1_plot %>%
1594- search_replace( "%", "\\\\%" ) %>%
1595- search_replace( "&", "\\\\&" ) %>%
1596- na_to_pattern(":") %>%
1597- pattern_to_pattern("NA", ":") %>%
1598- pattern_to_pattern("NA", ":") %>%
1599- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
1600- col.names = nn,
1601- caption = "Covid19 Measures by Legal Basis (Decided Cases)"
1602- ) %>%
1603- kable_styling(latex_options = c("striped", "hold_position"),
1604- full_width = F## , font_size = 7
1605- ) %>%
1606- footnote(general=c(
1607- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
1608- threeparttable = T) ## %>%
1609- ## row_spec(pos, bold = T)
1610-
1611-
1612-
1613-
1614-
1615-writeLines(
1616- c(
1617- "\\documentclass{article}",
1618- "\\usepackage[a4paper]{geometry}",
1619- "\\usepackage{helvet}",
1620- "\\usepackage[flushleft]{threeparttable}" ,
1621- "\\usepackage{graphicx}",
1622- "\\renewcommand{\\familydefault}{\\sfdefault}",
1623- "\\usepackage{caption}",
1624- "\\usepackage[labelfont=bf,font=large]{caption}",
1625- "\\usepackage{makecell}",
1626- "\\usepackage{booktabs}",
1627-"\\usepackage{colortbl, xcolor}",
1628-"\\begin{document}",
1629-"\\thispagestyle{empty}",
1630-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
1631- ll,
1632- "\\end{document}"
1633- ),
1634- "table5.tex"
1635-)
1636-
1637-
1638-
1639-tools::texi2pdf("table5.tex", clean = TRUE)
1736+ t1 <- measures_covid %>%
1737+ mutate(share=round_preserve_sum(share,4))
1738+
1739+ fl5 <- t1 %>% flextable() %>%
1740+ ## add_header_row(values = c("some measures", "other measures") )%>%
1741+ set_header_labels(legal_basis="Legal Basis",
1742+ n_measures="Number of Measures",
1743+ share="Share of Total") %>%
1744+ theme_zebra() %>%
1745+ bold(j = 1, bold = TRUE) %>%
1746+ fontsize(part = "all", size = 8) %>%
1747+ font(part="all", fontname = "Verdana") %>%
1748+ colformat_double(big.mark = " ") %>%
1749+ set_formatter(share = function(x) sprintf( "%.2f%%", x*100 ) ) %>%
1750+ ## set_formatter(gdp = function(x) sprintf( "%.1f%%", x*100 ) ) %>%
1751+ ## width(width = 1.7) %>%
1752+ FitFlextableToPage() %>%
1753+ set_caption(caption = "Covid19 Measures by Legal Basis (Decided Cases)")
1754+
1755+
1756+
1757+ save_as_docx(fl5, path="table5_flex.docx" )
1758+
1759+
1760+
1761+
1762+
1763+ ## %>%
1764+ ## mutate(share=share*100) %>%
1765+ ## mutate(
1766+ ## share=format_col(share,2)) %>%
1767+ ## mutate(share=paste(share, "%", sep=""))
1768+
1769+
1770+
1771+
1772+## t1 <- measures_covid %>%
1773+## mutate(share=share*100) %>%
1774+## mutate(
1775+## share=format_col(share,2)) %>%
1776+## mutate(share=paste(share, "%", sep=""))
1777+
1778+
1779+
1780+## nn <- linebreak( c("Legal Basis",
1781+## "Number of\nMeasures", "Share of\nTotal"
1782+## ) ,
1783+## align="c")
1784+
1785+
1786+## t1_plot <- t1
1787+
1788+## ll <- t1_plot %>%
1789+## search_replace( "%", "\\\\%" ) %>%
1790+## search_replace( "&", "\\\\&" ) %>%
1791+## na_to_pattern(":") %>%
1792+## pattern_to_pattern("NA", ":") %>%
1793+## pattern_to_pattern("NA", ":") %>%
1794+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
1795+## col.names = nn,
1796+## caption = "Covid19 Measures by Legal Basis (Decided Cases)"
1797+## ) %>%
1798+## kable_styling(latex_options = c("striped", "hold_position"),
1799+## full_width = F## , font_size = 7
1800+## ) %>%
1801+## footnote(general=c(
1802+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
1803+## threeparttable = T) ## %>%
1804+## ## row_spec(pos, bold = T)
1805+
1806+
1807+
1808+
1809+
1810+## writeLines(
1811+## c(
1812+## "\\documentclass{article}",
1813+## "\\usepackage[a4paper]{geometry}",
1814+## "\\usepackage{helvet}",
1815+## "\\usepackage[flushleft]{threeparttable}" ,
1816+## "\\usepackage{graphicx}",
1817+## "\\renewcommand{\\familydefault}{\\sfdefault}",
1818+## "\\usepackage{caption}",
1819+## "\\usepackage[labelfont=bf,font=large]{caption}",
1820+## "\\usepackage{makecell}",
1821+## "\\usepackage{booktabs}",
1822+## "\\usepackage{colortbl, xcolor}",
1823+## "\\begin{document}",
1824+## "\\thispagestyle{empty}",
1825+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
1826+## ll,
1827+## "\\end{document}"
1828+## ),
1829+## "table5.tex"
1830+## )
1831+
1832+
1833+
1834+## tools::texi2pdf("table5.tex", clean = TRUE)
16401835
16411836
16421837 ######################################################################
@@ -1649,69 +1844,98 @@
16491844
16501845 t1 <- sa_n_pn %>%
16511846 left_join(y=temp, by=c("decided"="x")) %>%
1652- select(name, nn, share)%>%
1653- mutate(share=share*100) %>%
1654- mutate(
1655- share=format_col(share,2)) %>%
1656- mutate(share=paste(share, "%", sep=""))
1657-
1658-
1659-
1660-nn <- linebreak( c("Case Assessment Status",
1661- "Number of\nCases", "Share of\nTotal"
1662- ) ,
1663- align="c")
1664-
1665-
1666-t1_plot <- t1
1667-
1668-ll <- t1_plot %>%
1669- search_replace( "%", "\\\\%" ) %>%
1670- search_replace( "&", "\\\\&" ) %>%
1671- na_to_pattern(":") %>%
1672- pattern_to_pattern("NA", ":") %>%
1673- pattern_to_pattern("NA", ":") %>%
1674- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
1675- col.names = nn,
1676- caption = "SA Case Assessment Pipeline\\\\Overview N and PN Cases"
1677- ) %>%
1678- kable_styling(latex_options = c("striped", "hold_position"),
1679- full_width = F## , font_size = 7
1680- ) %>%
1681- footnote(general=c(
1682- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
1683- threeparttable = T) ## %>%
1684- ## row_spec(pos, bold = T)
1685-
1686-
1687-
1688-
1689-
1690-writeLines(
1691- c(
1692- "\\documentclass{article}",
1693- "\\usepackage[a4paper]{geometry}",
1694- "\\usepackage{helvet}",
1695- "\\usepackage[flushleft]{threeparttable}" ,
1696- "\\usepackage{graphicx}",
1697- "\\renewcommand{\\familydefault}{\\sfdefault}",
1698- "\\usepackage{caption}",
1699- "\\usepackage[labelfont=bf,font=large]{caption}",
1700- "\\usepackage{makecell}",
1701- "\\usepackage{booktabs}",
1702-"\\usepackage{colortbl, xcolor}",
1703-"\\begin{document}",
1704-"\\thispagestyle{empty}",
1705-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
1706- ll,
1707- "\\end{document}"
1708- ),
1709- "table6.tex"
1710-)
1711-
1712-
1713-
1714-tools::texi2pdf("table6.tex", clean = TRUE)
1847+ select(name, nn, share) %>%
1848+ mutate(share=round_preserve_sum(share,3))
1849+
1850+ fl6 <- t1 %>% flextable() %>%
1851+ ## add_header_row(values = c("some measures", "other measures") )%>%
1852+ set_header_labels(name="Case Assessment Status",
1853+ nn="Number of Cases",
1854+ share="Share of Total") %>%
1855+ theme_zebra() %>%
1856+ bold(j = 1, bold = TRUE) %>%
1857+ fontsize(part = "all", size = 8) %>%
1858+ font(part="all", fontname = "Verdana") %>%
1859+ colformat_double(big.mark = " ") %>%
1860+ set_formatter(share = function(x) sprintf( "%.1f%%", x*100 ) ) %>%
1861+ ## set_formatter(gdp = function(x) sprintf( "%.1f%%", x*100 ) ) %>%
1862+ ## width(width = 1.7) %>%
1863+ FitFlextableToPage() %>%
1864+ set_caption(caption = "SA Case Assessment Pipeline
1865+Overview N and PN Cases")
1866+
1867+
1868+
1869+ save_as_docx(fl6, path="table6_flex.docx" )
1870+
1871+
1872+
1873+
1874+## t1 <- sa_n_pn %>%
1875+## left_join(y=temp, by=c("decided"="x")) %>%
1876+## select(name, nn, share)%>%
1877+## mutate(share=share*100) %>%
1878+## mutate(
1879+## share=format_col(share,2)) %>%
1880+## mutate(share=paste(share, "%", sep=""))
1881+
1882+
1883+
1884+## nn <- linebreak( c("Case Assessment Status",
1885+## "Number of\nCases", "Share of\nTotal"
1886+## ) ,
1887+## align="c")
1888+
1889+
1890+## t1_plot <- t1
1891+
1892+## ll <- t1_plot %>%
1893+## search_replace( "%", "\\\\%" ) %>%
1894+## search_replace( "&", "\\\\&" ) %>%
1895+## na_to_pattern(":") %>%
1896+## pattern_to_pattern("NA", ":") %>%
1897+## pattern_to_pattern("NA", ":") %>%
1898+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
1899+## col.names = nn,
1900+## caption = "SA Case Assessment Pipeline\\\\Overview N and PN Cases"
1901+## ) %>%
1902+## kable_styling(latex_options = c("striped", "hold_position"),
1903+## full_width = F## , font_size = 7
1904+## ) %>%
1905+## footnote(general=c(
1906+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
1907+## threeparttable = T) ## %>%
1908+## ## row_spec(pos, bold = T)
1909+
1910+
1911+
1912+
1913+
1914+## writeLines(
1915+## c(
1916+## "\\documentclass{article}",
1917+## "\\usepackage[a4paper]{geometry}",
1918+## "\\usepackage{helvet}",
1919+## "\\usepackage[flushleft]{threeparttable}" ,
1920+## "\\usepackage{graphicx}",
1921+## "\\renewcommand{\\familydefault}{\\sfdefault}",
1922+## "\\usepackage{caption}",
1923+## "\\usepackage[labelfont=bf,font=large]{caption}",
1924+## "\\usepackage{makecell}",
1925+## "\\usepackage{booktabs}",
1926+## "\\usepackage{colortbl, xcolor}",
1927+## "\\begin{document}",
1928+## "\\thispagestyle{empty}",
1929+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
1930+## ll,
1931+## "\\end{document}"
1932+## ),
1933+## "table6.tex"
1934+## )
1935+
1936+
1937+
1938+## tools::texi2pdf("table6.tex", clean = TRUE)
17151939
17161940 #######################################################################
17171941 #######################################################################
@@ -1721,71 +1945,100 @@
17211945
17221946
17231947
1724-t1 <- sa_n_pn_unit %>%
1725- ## left_join(y=temp, by=c("decided"="x")) %>%
1726- ## select(name, nn, share)%>%
1727- mutate(share=share*100) %>%
1728- mutate(
1729- share=format_col(share,2)) %>%
1730- mutate(share=paste(share, "%", sep=""))
1731-
1732-
1733-
1734-nn <- linebreak( c("Responsible Unit",
1735- "Number of\nCases", "Share of\nTotal"
1736- ) ,
1737- align="c")
1738-
1739-
1740-t1_plot <- t1
1741-
1742-ll <- t1_plot %>%
1743- search_replace( "%", "\\\\%" ) %>%
1744- search_replace( "&", "\\\\&" ) %>%
1745- na_to_pattern(":") %>%
1746- pattern_to_pattern("NA", ":") %>%
1747- pattern_to_pattern("NA", ":") %>%
1748- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
1749- col.names = nn,
1750- caption = "SA Case Assessment Pipeline\\\\Overview N and PN Cases"
1751- ) %>%
1752- kable_styling(latex_options = c("striped", "hold_position"),
1753- full_width = F## , font_size = 7
1754- ) %>%
1755- footnote(general=c(
1756- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
1757- threeparttable = T) ## %>%
1758- ## row_spec(pos, bold = T)
1759-
1760-
1761-
1762-
1763-
1764-writeLines(
1765- c(
1766- "\\documentclass{article}",
1767- "\\usepackage[a4paper]{geometry}",
1768- "\\usepackage{helvet}",
1769- "\\usepackage[flushleft]{threeparttable}" ,
1770- "\\usepackage{graphicx}",
1771- "\\renewcommand{\\familydefault}{\\sfdefault}",
1772- "\\usepackage{caption}",
1773- "\\usepackage[labelfont=bf,font=large]{caption}",
1774- "\\usepackage{makecell}",
1775- "\\usepackage{booktabs}",
1776-"\\usepackage{colortbl, xcolor}",
1777-"\\begin{document}",
1778-"\\thispagestyle{empty}",
1779-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
1780- ll,
1781- "\\end{document}"
1782- ),
1783- "table7.tex"
1784-)
1785-
1786-
1787-
1788-tools::texi2pdf("table7.tex", clean = TRUE)
1948+ t1 <- sa_n_pn_unit %>%
1949+ mutate(share=round_preserve_sum(share,4))
1950+
1951+
1952+
1953+ fl7 <- t1 %>% flextable() %>%
1954+ ## add_header_row(values = c("some measures", "other measures") )%>%
1955+ set_header_labels(responsible_unit="Responsible Unit",
1956+ nn="Number of Cases",
1957+ share="Share of Total") %>%
1958+ theme_zebra() %>%
1959+ bold(j = 1, bold = TRUE) %>%
1960+ fontsize(part = "all", size = 8) %>%
1961+ font(part="all", fontname = "Verdana") %>%
1962+ colformat_double(big.mark = " ") %>%
1963+ set_formatter(share = function(x) sprintf( "%.2f%%", x*100 ) ) %>%
1964+ ## set_formatter(gdp = function(x) sprintf( "%.1f%%", x*100 ) ) %>%
1965+ ## width(width = 1.7) %>%
1966+ FitFlextableToPage() %>%
1967+ set_caption(caption = "SA Case Assessment Pipeline
1968+Overview N and PN Cases")
1969+
1970+
1971+
1972+ save_as_docx(fl7, path="table7_flex.docx" )
1973+
1974+
1975+
1976+## t1 <- sa_n_pn_unit %>%
1977+## ## left_join(y=temp, by=c("decided"="x")) %>%
1978+## ## select(name, nn, share)%>%
1979+## mutate(share=share*100) %>%
1980+## mutate(
1981+## share=format_col(share,2)) %>%
1982+## mutate(share=paste(share, "%", sep=""))
1983+
1984+
1985+
1986+
1987+## nn <- linebreak( c("Responsible Unit",
1988+## "Number of\nCases", "Share of\nTotal"
1989+## ) ,
1990+## align="c")
1991+
1992+
1993+## t1_plot <- t1
1994+
1995+## ll <- t1_plot %>%
1996+## search_replace( "%", "\\\\%" ) %>%
1997+## search_replace( "&", "\\\\&" ) %>%
1998+## na_to_pattern(":") %>%
1999+## pattern_to_pattern("NA", ":") %>%
2000+## pattern_to_pattern("NA", ":") %>%
2001+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
2002+## col.names = nn,
2003+## caption = "SA Case Assessment Pipeline\\\\Overview N and PN Cases"
2004+## ) %>%
2005+## kable_styling(latex_options = c("striped", "hold_position"),
2006+## full_width = F## , font_size = 7
2007+## ) %>%
2008+## footnote(general=c(
2009+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
2010+## threeparttable = T) ## %>%
2011+## ## row_spec(pos, bold = T)
2012+
2013+
2014+
2015+
2016+
2017+## writeLines(
2018+## c(
2019+## "\\documentclass{article}",
2020+## "\\usepackage[a4paper]{geometry}",
2021+## "\\usepackage{helvet}",
2022+## "\\usepackage[flushleft]{threeparttable}" ,
2023+## "\\usepackage{graphicx}",
2024+## "\\renewcommand{\\familydefault}{\\sfdefault}",
2025+## "\\usepackage{caption}",
2026+## "\\usepackage[labelfont=bf,font=large]{caption}",
2027+## "\\usepackage{makecell}",
2028+## "\\usepackage{booktabs}",
2029+## "\\usepackage{colortbl, xcolor}",
2030+## "\\begin{document}",
2031+## "\\thispagestyle{empty}",
2032+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
2033+## ll,
2034+## "\\end{document}"
2035+## ),
2036+## "table7.tex"
2037+## )
2038+
2039+
2040+
2041+## tools::texi2pdf("table7.tex", clean = TRUE)
17892042
17902043
17912044
@@ -1797,83 +2050,114 @@
17972050 #######################################################################
17982051
17992052
1800-t1 <- budget_by_beneficiary_sector %>%
1801- mutate(share=share*100) %>%
1802- mutate(
1803- share=format_col(share,2)) %>%
1804- mutate(share=paste(share, "%", sep="")) %>%
1805- mutate(budget=format_col(budget,1))
2053+
2054+ t1 <- budget_by_beneficiary_sector %>%
2055+ mutate(share=round_preserve_sum(share,4))
2056+
2057+
2058+
2059+
2060+ fl8 <- t1 %>% flextable() %>%
2061+ ## add_header_row(values = c("some measures", "other measures") )%>%
2062+ set_header_labels(beneficary_sector="Sector",
2063+ budget="Allocated Budget (mio €)",
2064+ share="Share of Total") %>%
2065+ theme_zebra() %>%
2066+ bold(j = 1, bold = TRUE) %>%
2067+ fontsize(part = "all", size = 8) %>%
2068+ font(part="all", fontname = "Verdana") %>%
2069+ colformat_double(big.mark = " ") %>%
2070+ set_formatter(share = function(x) sprintf( "%.2f%%", x*100 ) ) %>%
2071+ ## set_formatter(gdp = function(x) sprintf( "%.1f%%", x*100 ) ) %>%
2072+ ## width(width = 1.7) %>%
2073+ FitFlextableToPage() %>%
2074+ set_caption(caption = "Covid19 Allocated Budget by Sector")
2075+
2076+
2077+
2078+ save_as_docx(fl8, path="table8_flex.docx" )
2079+
2080+
2081+
2082+
18062083
1807-
1808-
1809-
1810-
1811-
1812-
1813-
1814-nn <- linebreak( c("Sector",
1815- "Allocated Budget\n(Million EUR)", "Share of\nTotal"
1816- ) ,
1817- align="c")
1818-
1819-
1820-t1_plot <- t1
1821-
1822-ll <- t1_plot %>%
1823- search_replace( "%", "\\\\%" ) %>%
1824- search_replace( "&", "\\\\&" ) %>%
1825- na_to_pattern(":") %>%
1826- pattern_to_pattern("NA", ":") %>%
1827- pattern_to_pattern("NA", ":") %>%
1828- kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",11)),
1829- col.names = nn,
1830- caption = "Covid19 Allocated Budget by Sector"
1831- ) %>%
1832- kable_styling(latex_options = c("striped", "hold_position"),
1833- full_width = F## , font_size = 7
1834- ) %>%
1835- footnote(general=c(
1836- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE## ,
1837- ## threeparttable = T
1838- ) ## %>%
1839- ## row_spec(pos, bold = T)
1840-
1841-
1842-
1843-
1844-
1845-writeLines(
1846- c(
1847- "\\documentclass{article}",
1848- "\\usepackage[a4paper]{geometry}",
1849- "\\usepackage{longtable}",
1850- "\\usepackage{helvet}",
1851- "\\usepackage[flushleft]{threeparttable}" ,
1852- "\\usepackage{graphicx}",
1853- "\\usepackage{eurosym}",
1854- "\\renewcommand{\\familydefault}{\\sfdefault}",
1855- "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
1856- "\\usepackage{makecell}",
1857- "\\usepackage{booktabs}",
1858-"\\usepackage{colortbl, xcolor}",
1859-"\\begin{document}",
1860-"\\pagestyle{empty}",
1861-"\\setlength{\\LTleft}{-20cm plus -1fill}",
1862-"\\setlength{\\LTright}{\\LTleft}",
1863-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
1864- ll,
1865- "\\end{document}"
1866- ),
1867- "table8.tex"
1868-)
1869-
1870-
1871-
1872-
1873-
1874-
1875-
1876-tools::texi2pdf("table8.tex", clean = TRUE)
2084+## t1 <- budget_by_beneficiary_sector %>%
2085+## mutate(share=share*100) %>%
2086+## mutate(
2087+## share=format_col(share,2)) %>%
2088+## mutate(share=paste(share, "%", sep="")) %>%
2089+## mutate(budget=format_col(budget,1))
2090+
2091+
2092+
2093+
2094+
2095+
2096+
2097+
2098+## nn <- linebreak( c("Sector",
2099+## "Allocated Budget\n(Million EUR)", "Share of\nTotal"
2100+## ) ,
2101+## align="c")
2102+
2103+
2104+## t1_plot <- t1
2105+
2106+## ll <- t1_plot %>%
2107+## search_replace( "%", "\\\\%" ) %>%
2108+## search_replace( "&", "\\\\&" ) %>%
2109+## na_to_pattern(":") %>%
2110+## pattern_to_pattern("NA", ":") %>%
2111+## pattern_to_pattern("NA", ":") %>%
2112+## kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",11)),
2113+## col.names = nn,
2114+## caption = "Covid19 Allocated Budget by Sector"
2115+## ) %>%
2116+## kable_styling(latex_options = c("striped", "hold_position"),
2117+## full_width = F## , font_size = 7
2118+## ) %>%
2119+## footnote(general=c(
2120+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE## ,
2121+## ## threeparttable = T
2122+## ) ## %>%
2123+## ## row_spec(pos, bold = T)
2124+
2125+
2126+
2127+
2128+
2129+## writeLines(
2130+## c(
2131+## "\\documentclass{article}",
2132+## "\\usepackage[a4paper]{geometry}",
2133+## "\\usepackage{longtable}",
2134+## "\\usepackage{helvet}",
2135+## "\\usepackage[flushleft]{threeparttable}" ,
2136+## "\\usepackage{graphicx}",
2137+## "\\usepackage{eurosym}",
2138+## "\\renewcommand{\\familydefault}{\\sfdefault}",
2139+## "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2140+## "\\usepackage{makecell}",
2141+## "\\usepackage{booktabs}",
2142+## "\\usepackage{colortbl, xcolor}",
2143+## "\\begin{document}",
2144+## "\\pagestyle{empty}",
2145+## "\\setlength{\\LTleft}{-20cm plus -1fill}",
2146+## "\\setlength{\\LTright}{\\LTleft}",
2147+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
2148+## ll,
2149+## "\\end{document}"
2150+## ),
2151+## "table8.tex"
2152+## )
2153+
2154+
2155+
2156+
2157+
2158+
2159+
2160+## tools::texi2pdf("table8.tex", clean = TRUE)
18772161
18782162
18792163 ##################################################################
@@ -1883,85 +2167,111 @@
18832167
18842168
18852169
1886-t1 <- budget_by_beneficiary_type %>%
1887- mutate(share=share*100) %>%
1888- mutate(
1889- share=format_col(share,2)) %>%
1890- mutate(share=paste(share, "%", sep="")) %>%
1891- mutate(budget=format_col(budget,1))
1892-
1893-
1894-
1895-
1896-
1897-
1898-
1899-
1900-
1901-
1902-nn <- linebreak( c("Beneficiary",
1903- "Allocated Budget\n(Million EUR)", "Share of\nTotal"
1904- ) ,
1905- align="c")
1906-
1907-
1908-t1_plot <- t1
1909-
1910-ll <- t1_plot %>%
1911- search_replace( "%", "\\\\%" ) %>%
1912- search_replace( "&", "\\\\&" ) %>%
1913- na_to_pattern(":") %>%
1914- pattern_to_pattern("NA", ":") %>%
1915- pattern_to_pattern("NA", ":") %>%
1916- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
1917- col.names = nn,
1918- caption = "Covid19 Allocated Budget by Type of Beneficiary"
1919- ) %>%
1920- kable_styling(latex_options = c("striped", "hold_position"),
1921- full_width = F## , font_size = 7
1922- ) %>%
1923- footnote(general=c(
1924- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
1925- threeparttable = T
1926- ) ## %>%
1927- ## row_spec(pos, bold = T)
1928-
1929-
1930-
1931-
1932-
1933-writeLines(
1934- c(
1935- "\\documentclass{article}",
1936- "\\usepackage[a4paper]{geometry}",
1937- "\\usepackage{longtable}",
1938- "\\usepackage{helvet}",
1939- "\\usepackage[flushleft]{threeparttable}" ,
1940- "\\usepackage{graphicx}",
1941- "\\usepackage{eurosym}",
1942- "\\renewcommand{\\familydefault}{\\sfdefault}",
1943- "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
1944- "\\usepackage{makecell}",
1945- "\\usepackage{booktabs}",
1946-"\\usepackage{colortbl, xcolor}",
1947-"\\begin{document}",
1948-"\\pagestyle{empty}",
1949-"\\setlength{\\LTleft}{-20cm plus -1fill}",
1950-"\\setlength{\\LTright}{\\LTleft}",
1951-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
1952- ll,
1953- "\\end{document}"
1954- ),
1955- "table9.tex"
1956-)
1957-
1958-
1959-
1960-
1961-
1962-
1963-
1964-tools::texi2pdf("table9.tex", clean = TRUE)
2170+ t1 <- budget_by_beneficiary_type %>%
2171+ mutate(share=round_preserve_sum(share,4))
2172+
2173+ fl9 <- t1 %>% flextable() %>%
2174+ ## add_header_row(values = c("some measures", "other measures") )%>%
2175+ set_header_labels(beneficary_type="Beneficiary",
2176+ budget="Allocated Budget (mio €)",
2177+ share="Share of Total") %>%
2178+ theme_zebra() %>%
2179+ bold(j = 1, bold = TRUE) %>%
2180+ fontsize(part = "all", size = 8) %>%
2181+ font(part="all", fontname = "Verdana") %>%
2182+ colformat_double(big.mark = " ") %>%
2183+ set_formatter(share = function(x) sprintf( "%.2f%%", x*100 ) ) %>%
2184+ ## set_formatter(gdp = function(x) sprintf( "%.1f%%", x*100 ) ) %>%
2185+ ## width(width = 1.7) %>%
2186+ FitFlextableToPage() %>%
2187+ set_caption(caption = "Covid19 Allocated Budget by Type of Beneficiary")
2188+
2189+
2190+
2191+ save_as_docx(fl9, path="table9_flex.docx" )
2192+
2193+
2194+
2195+
2196+## t1 <- budget_by_beneficiary_type %>%
2197+## mutate(share=share*100) %>%
2198+## mutate(
2199+## share=format_col(share,2)) %>%
2200+## mutate(share=paste(share, "%", sep="")) %>%
2201+## mutate(budget=format_col(budget,1))
2202+
2203+
2204+
2205+
2206+
2207+
2208+
2209+
2210+
2211+
2212+## nn <- linebreak( c("Beneficiary",
2213+## "Allocated Budget\n(Million EUR)", "Share of\nTotal"
2214+## ) ,
2215+## align="c")
2216+
2217+
2218+## t1_plot <- t1
2219+
2220+## ll <- t1_plot %>%
2221+## search_replace( "%", "\\\\%" ) %>%
2222+## search_replace( "&", "\\\\&" ) %>%
2223+## na_to_pattern(":") %>%
2224+## pattern_to_pattern("NA", ":") %>%
2225+## pattern_to_pattern("NA", ":") %>%
2226+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
2227+## col.names = nn,
2228+## caption = "Covid19 Allocated Budget by Type of Beneficiary"
2229+## ) %>%
2230+## kable_styling(latex_options = c("striped", "hold_position"),
2231+## full_width = F## , font_size = 7
2232+## ) %>%
2233+## footnote(general=c(
2234+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
2235+## threeparttable = T
2236+## ) ## %>%
2237+## ## row_spec(pos, bold = T)
2238+
2239+
2240+
2241+
2242+
2243+## writeLines(
2244+## c(
2245+## "\\documentclass{article}",
2246+## "\\usepackage[a4paper]{geometry}",
2247+## "\\usepackage{longtable}",
2248+## "\\usepackage{helvet}",
2249+## "\\usepackage[flushleft]{threeparttable}" ,
2250+## "\\usepackage{graphicx}",
2251+## "\\usepackage{eurosym}",
2252+## "\\renewcommand{\\familydefault}{\\sfdefault}",
2253+## "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2254+## "\\usepackage{makecell}",
2255+## "\\usepackage{booktabs}",
2256+## "\\usepackage{colortbl, xcolor}",
2257+## "\\begin{document}",
2258+## "\\pagestyle{empty}",
2259+## "\\setlength{\\LTleft}{-20cm plus -1fill}",
2260+## "\\setlength{\\LTright}{\\LTleft}",
2261+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
2262+## ll,
2263+## "\\end{document}"
2264+## ),
2265+## "table9.tex"
2266+## )
2267+
2268+
2269+
2270+
2271+
2272+
2273+
2274+## tools::texi2pdf("table9.tex", clean = TRUE)
19652275
19662276 ##############################################################à
19672277 ##############################################################à
@@ -1972,74 +2282,100 @@
19722282
19732283 t1 <- duration_stat_basis %>%
19742284 select(legal_basis, mean_duration) %>%
1975- mutate(mean_duration=format_col(mean_duration, 1))
1976-
1977-
1978-
1979-
1980-nn <- linebreak( c("Legal Basis",
1981- "Number of Days"
1982- ) ,
1983- align="c")
1984-
1985-
1986-t1_plot <- t1
1987-
1988-ll <- t1_plot %>%
1989- search_replace( "%", "\\\\%" ) %>%
1990- search_replace( "&", "\\\\&" ) %>%
1991- na_to_pattern(":") %>%
1992- pattern_to_pattern("NA", ":") %>%
1993- pattern_to_pattern("NA", ":") %>%
1994- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
1995- col.names = nn,
1996- caption = "Average Number of Days to Process a Decision\\\\by Legal Basis"
1997- ) %>%
1998- kable_styling(latex_options = c("striped", "hold_position"),
1999- full_width = F## , font_size = 7
2000- ) %>%
2001- footnote(general=c(
2002- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
2003- threeparttable = T
2004- ) ## %>%
2005- ## row_spec(pos, bold = T)
2006-
2007-
2008-
2009-
2010-
2011-writeLines(
2012- c(
2013- "\\documentclass{article}",
2014- "\\usepackage[a4paper]{geometry}",
2015- "\\usepackage{longtable}",
2016- "\\usepackage{helvet}",
2017- "\\usepackage[flushleft]{threeparttable}" ,
2018- "\\usepackage{graphicx}",
2019- "\\usepackage{eurosym}",
2020- "\\renewcommand{\\familydefault}{\\sfdefault}",
2021- "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2022- "\\usepackage{makecell}",
2023- "\\usepackage{booktabs}",
2024-"\\usepackage{colortbl, xcolor}",
2025-"\\begin{document}",
2026-"\\pagestyle{empty}",
2027-"\\setlength{\\LTleft}{-20cm plus -1fill}",
2028-"\\setlength{\\LTright}{\\LTleft}",
2029-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
2030- ll,
2031- "\\end{document}"
2032- ),
2033- "table10.tex"
2034-)
2035-
2036-
2037-
2038-
2039-
2040-
2041-
2042-tools::texi2pdf("table10.tex", clean = TRUE)
2285+ mutate(mean_duration=as.numeric(round(mean_duration,1)))
2286+
2287+
2288+ fl10 <- t1 %>% flextable() %>%
2289+ ## add_header_row(values = c("some measures", "other measures") )%>%
2290+ set_header_labels(legal_basis="Legal Basis",
2291+ mean_duration="Number of Calendar Days") %>%
2292+ theme_zebra() %>%
2293+ bold(j = 1, bold = TRUE) %>%
2294+ fontsize(part = "all", size = 8) %>%
2295+ font(part="all", fontname = "Verdana") %>%
2296+ colformat_double(big.mark = " ") %>%
2297+ ## set_formatter(gdp = function(x) sprintf( "%.1f%%", x*100 ) ) %>%
2298+ ## width(width = 1.7) %>%
2299+ FitFlextableToPage() %>%
2300+ set_caption(caption = "Average Number of Days to Process a Decision
2301+by Legal Basis")
2302+
2303+
2304+
2305+ save_as_docx(fl10, path="table10_flex.docx" )
2306+
2307+
2308+
2309+## t1 <- duration_stat_basis %>%
2310+## select(legal_basis, mean_duration) %>%
2311+## mutate(mean_duration=format_col(mean_duration, 1))
2312+
2313+
2314+
2315+
2316+## nn <- linebreak( c("Legal Basis",
2317+## "Number of Days"
2318+## ) ,
2319+## align="c")
2320+
2321+
2322+## t1_plot <- t1
2323+
2324+## ll <- t1_plot %>%
2325+## search_replace( "%", "\\\\%" ) %>%
2326+## search_replace( "&", "\\\\&" ) %>%
2327+## na_to_pattern(":") %>%
2328+## pattern_to_pattern("NA", ":") %>%
2329+## pattern_to_pattern("NA", ":") %>%
2330+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
2331+## col.names = nn,
2332+## caption = "Average Number of Days to Process a Decision\\\\by Legal Basis"
2333+## ) %>%
2334+## kable_styling(latex_options = c("striped", "hold_position"),
2335+## full_width = F## , font_size = 7
2336+## ) %>%
2337+## footnote(general=c(
2338+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
2339+## threeparttable = T
2340+## ) ## %>%
2341+## ## row_spec(pos, bold = T)
2342+
2343+
2344+
2345+
2346+
2347+## writeLines(
2348+## c(
2349+## "\\documentclass{article}",
2350+## "\\usepackage[a4paper]{geometry}",
2351+## "\\usepackage{longtable}",
2352+## "\\usepackage{helvet}",
2353+## "\\usepackage[flushleft]{threeparttable}" ,
2354+## "\\usepackage{graphicx}",
2355+## "\\usepackage{eurosym}",
2356+## "\\renewcommand{\\familydefault}{\\sfdefault}",
2357+## "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2358+## "\\usepackage{makecell}",
2359+## "\\usepackage{booktabs}",
2360+## "\\usepackage{colortbl, xcolor}",
2361+## "\\begin{document}",
2362+## "\\pagestyle{empty}",
2363+## "\\setlength{\\LTleft}{-20cm plus -1fill}",
2364+## "\\setlength{\\LTright}{\\LTleft}",
2365+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
2366+## ll,
2367+## "\\end{document}"
2368+## ),
2369+## "table10.tex"
2370+## )
2371+
2372+
2373+
2374+
2375+
2376+
2377+
2378+## tools::texi2pdf("table10.tex", clean = TRUE)
20432379
20442380 ############################################################à
20452381 ############################################################à
@@ -2047,74 +2383,104 @@
20472383 ############################################################à
20482384
20492385
2050-
2051-
2052-
20532386 t1 <- duration_stat_measure %>%
20542387 select(type_of_measure, mean_duration) %>%
2055- mutate(mean_duration=format_col(mean_duration, 1))%>%
2056- mutate(type_of_measure=wrapper_text(type_of_measure,65))
2057-
2058-
2059-
2060-nn <- linebreak( c("Type of Measure",
2061- "Number of Days"
2062- ) ,
2063- align="c")
2064-
2065-
2066-t1_plot <- t1
2067-
2068-ll <- t1_plot %>%
2069- search_replace( "%", "\\\\%" ) %>%
2070- search_replace( "&", "\\\\&" ) %>%
2071- na_to_pattern(":") %>%
2072- pattern_to_pattern("NA", ":") %>%
2073-
2074- ## kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",6)),
2388+ mutate(mean_duration=as.numeric(round(mean_duration,1)))
2389+
2390+
2391+ fl11 <- t1 %>% flextable() %>%
2392+ ## add_header_row(values = c("some measures", "other measures") )%>%
2393+ set_header_labels(type_of_measure="Type of Measure",
2394+ mean_duration="Number of Calendar Days") %>%
2395+ theme_zebra() %>%
2396+ bold(j = 1, bold = TRUE) %>%
2397+ fontsize(part = "all", size = 8) %>%
2398+ font(part="all", fontname = "Verdana") %>%
2399+ colformat_double(big.mark = " ") %>%
2400+ ## set_formatter(gdp = function(x) sprintf( "%.1f%%", x*100 ) ) %>%
2401+ ## width(width = 1.7) %>%
2402+ FitFlextableToPage() %>%
2403+ set_caption(caption = "Average Number of Days to Process a Decision
2404+by Type of Measure")
2405+
2406+
2407+
2408+ save_as_docx(fl11, path="table11_flex.docx" )
2409+
2410+
2411+
2412+
2413+
2414+
2415+
2416+
2417+
2418+
2419+## t1 <- duration_stat_measure %>%
2420+## select(type_of_measure, mean_duration) %>%
2421+## mutate(mean_duration=format_col(mean_duration, 1))%>%
2422+## mutate(type_of_measure=wrapper_text(type_of_measure,65))
2423+
2424+
2425+
2426+## nn <- linebreak( c("Type of Measure",
2427+## "Number of Days"
2428+## ) ,
2429+## align="c")
2430+
2431+
2432+## t1_plot <- t1
2433+
2434+## ll <- t1_plot %>%
2435+## search_replace( "%", "\\\\%" ) %>%
2436+## search_replace( "&", "\\\\&" ) %>%
2437+## na_to_pattern(":") %>%
2438+## pattern_to_pattern("NA", ":") %>%
2439+
2440+## ## kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",6)),
20752441
20762442
2077- kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",2)),
2078- col.names = nn,
2079- caption = "Average Number of Days to Process a Decision\\\\by Legal Basis"
2080- ) %>%
2081- kable_styling( position = "center",
2082- latex_options = c("repeat_header","striped" , "hold_position"),
2083- full_width = F) %>%
2084- footnote(general=c(
2085- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE) ## %>%
2086- ## row_spec(pos, bold = T)
2087-
2088-
2089-
2090-writeLines(
2091- c(
2092- "\\documentclass{article}",
2093- "\\usepackage[a4paper]{geometry}",
2094- "\\usepackage{longtable}",
2095- "\\usepackage{helvet}",
2096- "\\usepackage[flushleft]{threeparttable}" ,
2097- "\\usepackage{graphicx}",
2098- "\\usepackage{eurosym}",
2099- "\\renewcommand{\\familydefault}{\\sfdefault}",
2100- "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2101- "\\usepackage{makecell}",
2102- "\\usepackage{booktabs}",
2103-"\\usepackage{colortbl, xcolor}",
2104-"\\begin{document}",
2105-"\\pagestyle{empty}",
2106-"\\setlength{\\LTleft}{-20cm plus -1fill}",
2107-"\\setlength{\\LTright}{\\LTleft}",
2108-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
2109- ll,
2110- "\\end{document}"
2111- ),
2112- "table11.tex"
2113-)
2114-
2115-
2116-
2117-tools::texi2pdf("table11.tex", clean = TRUE)
2443+## kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",2)),
2444+## col.names = nn,
2445+## caption = "Average Number of Days to Process a Decision\\\\by Legal Basis"
2446+## ) %>%
2447+## kable_styling( position = "center",
2448+## latex_options = c("repeat_header","striped" , "hold_position"),
2449+## full_width = F) %>%
2450+## footnote(general=c(
2451+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE) ## %>%
2452+## ## row_spec(pos, bold = T)
2453+
2454+
2455+
2456+## writeLines(
2457+## c(
2458+## "\\documentclass{article}",
2459+## "\\usepackage[a4paper]{geometry}",
2460+## "\\usepackage{longtable}",
2461+## "\\usepackage{helvet}",
2462+## "\\usepackage[flushleft]{threeparttable}" ,
2463+## "\\usepackage{graphicx}",
2464+## "\\usepackage{eurosym}",
2465+## "\\renewcommand{\\familydefault}{\\sfdefault}",
2466+## "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2467+## "\\usepackage{makecell}",
2468+## "\\usepackage{booktabs}",
2469+## "\\usepackage{colortbl, xcolor}",
2470+## "\\begin{document}",
2471+## "\\pagestyle{empty}",
2472+## "\\setlength{\\LTleft}{-20cm plus -1fill}",
2473+## "\\setlength{\\LTright}{\\LTleft}",
2474+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
2475+## ll,
2476+## "\\end{document}"
2477+## ),
2478+## "table11.tex"
2479+## )
2480+
2481+
2482+
2483+## tools::texi2pdf("table11.tex", clean = TRUE)
21182484
21192485 ###################################################################
21202486 ###################################################################
@@ -2123,9 +2489,11 @@
21232489
21242490
21252491
2126-temp <- tibble(x=c("TF1", "TF2", "TF3", "TF6", "TF7", "TF8", "TF9",
2492+temp <- tibble(x=c("TF1", "TF2", "TF3","TF4", "TF6", "TF7", "TF8", "TF9",
21272493 "TF10", "TF11", "TF12", "Total"),
21282494 name=c("3.1 Limited amount of aid", "3.2 Aid in the form of guarantees on loans", "3.3 Aid in the form of subsidised interest rates for loans",
2495+ "3.4 Aid in the form of guarantees and loans channelled through credit institutions or other
2496+financial institutions",
21292497 "3.6 Aid for COVID-19 relevant research and development",
21302498 "3.7 Investment aid for testing and upscaling infrastructures",
21312499 "3.8 Investment aid for the production of COVID-19 relevant products",
@@ -2137,92 +2505,115 @@
21372505
21382506 )
21392507
2140-
2141-
2142-
21432508 t1 <- chapters_stat_fin %>%
21442509 left_join(y=temp, by=c("TF_chapter"="x")) %>%
21452510 select(name, value, share) %>%
2146- mutate(share=share*100) %>%
2147- mutate(
2148- share=format_col(share,2)) %>%
2149- mutate(share=paste(share, "%", sep="")) %>%
2150- mutate(name=wrapper_text(name, 65))
2151-
2152-nn <- linebreak( c("Chapter Description",
2153- "Frequency", "Share of\nTotal"
2154- ) ,
2155- align="c")
2156-
2157-
2158-t1_plot <- t1
2159-
2160-ll <- t1_plot %>%
2161- search_replace( "%", "\\\\%" ) %>%
2162- search_replace( "&", "\\\\&" ) %>%
2163- na_to_pattern(":") %>%
2164- pattern_to_pattern("NA", ":") %>%
2165- pattern_to_pattern("NA", ":") %>%
2166- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
2167- col.names = nn,
2168- caption = "Frequency of Use of Temporary Framework Chapters"
2169- ) %>%
2170- kable_styling(latex_options = c("striped", "hold_position"),
2171- full_width = F## , font_size = 7
2172- ) %>%
2173- footnote(general=c(
2174- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
2175- threeparttable = T
2176- ) ## %>%
2177- ## row_spec(pos, bold = T)
2178-
2179-
2180-
2181-
2182-
2183-writeLines(
2184- c(
2185- "\\documentclass{article}",
2186- "\\usepackage[a4paper]{geometry}",
2187- "\\usepackage{longtable}",
2188- "\\usepackage{helvet}",
2189- "\\usepackage[flushleft]{threeparttable}" ,
2190- "\\usepackage{graphicx}",
2191- "\\usepackage{eurosym}",
2192- "\\renewcommand{\\familydefault}{\\sfdefault}",
2193- "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2194- "\\usepackage{makecell}",
2195- "\\usepackage{booktabs}",
2196-"\\usepackage{colortbl, xcolor}",
2197-"\\begin{document}",
2198-"\\pagestyle{empty}",
2199-"\\setlength{\\LTleft}{-20cm plus -1fill}",
2200-"\\setlength{\\LTright}{\\LTleft}",
2201-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
2202- ll,
2203- "\\end{document}"
2204- ),
2205- "table12.tex"
2206-)
2207-
2208-
2209-
2210-
2211-
2212-
2213-
2214-tools::texi2pdf("table12.tex", clean = TRUE)
2215-
2216-
2217-
2218-
2219-
2220-
2221-###join all the docs
2222-
2223-fn <- paste("summary_tables_generated_on_", Sys.Date(), ".pdf", sep="")
2224-
2225-system(paste("pdftk table1.pdf table2.pdf table3.pdf table4.pdf table5.pdf table6.pdf table7.pdf table8.pdf table9.pdf table10.pdf table11.pdf table12.pdf cat output ", fn) )
2511+ mutate(share=round_preserve_sum(share,4))
2512+
2513+ fl12 <- t1 %>% flextable() %>%
2514+ ## add_header_row(values = c("some measures", "other measures") )%>%
2515+ set_header_labels(name="Chapter Description",
2516+ value="Frequency",
2517+ share="Share of Total") %>%
2518+ theme_zebra() %>%
2519+ bold(j = 1, bold = TRUE) %>%
2520+ fontsize(part = "all", size = 8) %>%
2521+ font(part="all", fontname = "Verdana") %>%
2522+ colformat_double(big.mark = " ") %>%
2523+ set_formatter(share = function(x) sprintf( "%.2f%%", x*100 ) ) %>%
2524+ ## set_formatter(gdp = function(x) sprintf( "%.1f%%", x*100 ) ) %>%
2525+ ## width(width = 1.7) %>%
2526+ FitFlextableToPage() %>%
2527+ set_caption(caption = "Frequency of Use of Temporary Framework Chapters")
2528+
2529+
2530+
2531+ save_as_docx(fl12, path="table12_flex.docx" )
2532+
2533+
2534+## t1 <- chapters_stat_fin %>%
2535+## left_join(y=temp, by=c("TF_chapter"="x")) %>%
2536+## select(name, value, share) %>%
2537+## mutate(share=share*100) %>%
2538+## mutate(
2539+## share=format_col(share,2)) %>%
2540+## mutate(share=paste(share, "%", sep="")) %>%
2541+## mutate(name=wrapper_text(name, 65))
2542+
2543+## nn <- linebreak( c("Chapter Description",
2544+## "Frequency", "Share of\nTotal"
2545+## ) ,
2546+## align="c")
2547+
2548+
2549+## t1_plot <- t1
2550+
2551+## ll <- t1_plot %>%
2552+## search_replace( "%", "\\\\%" ) %>%
2553+## search_replace( "&", "\\\\&" ) %>%
2554+## na_to_pattern(":") %>%
2555+## pattern_to_pattern("NA", ":") %>%
2556+## pattern_to_pattern("NA", ":") %>%
2557+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
2558+## col.names = nn,
2559+## caption = "Frequency of Use of Temporary Framework Chapters"
2560+## ) %>%
2561+## kable_styling(latex_options = c("striped", "hold_position"),
2562+## full_width = F## , font_size = 7
2563+## ) %>%
2564+## footnote(general=c(
2565+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
2566+## threeparttable = T
2567+## ) ## %>%
2568+## ## row_spec(pos, bold = T)
2569+
2570+
2571+
2572+
2573+
2574+## writeLines(
2575+## c(
2576+## "\\documentclass{article}",
2577+## "\\usepackage[a4paper]{geometry}",
2578+## "\\usepackage{longtable}",
2579+## "\\usepackage{helvet}",
2580+## "\\usepackage[flushleft]{threeparttable}" ,
2581+## "\\usepackage{graphicx}",
2582+## "\\usepackage{eurosym}",
2583+## "\\renewcommand{\\familydefault}{\\sfdefault}",
2584+## "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2585+## "\\usepackage{makecell}",
2586+## "\\usepackage{booktabs}",
2587+## "\\usepackage{colortbl, xcolor}",
2588+## "\\begin{document}",
2589+## "\\pagestyle{empty}",
2590+## "\\setlength{\\LTleft}{-20cm plus -1fill}",
2591+## "\\setlength{\\LTright}{\\LTleft}",
2592+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
2593+## ll,
2594+## "\\end{document}"
2595+## ),
2596+## "table12.tex"
2597+## )
2598+
2599+
2600+
2601+
2602+
2603+
2604+
2605+## tools::texi2pdf("table12.tex", clean = TRUE)
2606+
2607+
2608+
2609+
2610+
2611+
2612+## ###join all the docs
2613+
2614+## fn <- paste("summary_tables_generated_on_", Sys.Date(), ".pdf", sep="")
2615+
2616+## system(paste("pdftk table1.pdf table2.pdf table3.pdf table4.pdf table5.pdf table6.pdf table7.pdf table8.pdf table9.pdf table10.pdf table11.pdf table12.pdf cat output ", fn) )
22262617
22272618
22282619
@@ -2234,186 +2625,186 @@
22342625
22352626
22362627
2237-## MS tables
2238-
2239-for (sel_ms in ms_list){
2240-
2241- print("The MS is,")
2242- print(sel_ms)
2628+## ## MS tables
2629+
2630+## for (sel_ms in ms_list){
2631+
2632+## print("The MS is,")
2633+## print(sel_ms)
22432634
22442635
2245-t1 <- budget_type_ms %>%
2246- filter(member_state_2_letter_code %in% sel_ms) %>%
2247- select(name, budget, share) %>%
2248- mutate(share=share*100) %>%
2249- mutate(budget=format_col(budget, 1),
2250- share=format_col(share,2)) %>%
2251- mutate(share=paste(share, "%", sep="")) ## %>%
2252- ## pattern_to_pattern("-", "Total EU")
2253-
2254-
2255-
2256-
2257-
2258-nn <- linebreak( c("Case Type",
2259- "Allocated Budget\n(Million EUR)", "Share of\nTotal"
2260- ) ,
2261- align="c")
2262-
2263-
2264-t1_plot <- t1
2265-
2266-ll <- t1_plot %>%
2267- search_replace( "%", "\\\\%" ) %>%
2268- na_to_pattern(":") %>%
2269- pattern_to_pattern("NA", ":") %>%
2270- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
2271- col.names = nn,
2272- caption = paste(sel_ms,": Covid19 Allocated Budget by Case Type (Decided Cases)", sep="")
2273- ) %>%
2274- kable_styling(latex_options = c("striped", "hold_position"),
2275- full_width = F## , font_size = 7
2276- ) %>%
2277- footnote(general=c(
2278- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
2279- threeparttable = T) ## %>%
2280- ## row_spec(pos, bold = T)
2281-
2282-
2283-
2284-
2285-
2286-writeLines(
2287- c(
2288- "\\documentclass{article}",
2289- "\\usepackage[a4paper]{geometry}",
2290- "\\usepackage{helvet}",
2291- "\\usepackage[flushleft]{threeparttable}" ,
2292- "\\usepackage{graphicx}",
2293- "\\renewcommand{\\familydefault}{\\sfdefault}",
2294- "\\usepackage{caption}",
2295- "\\usepackage[labelfont=bf,font=large]{caption}",
2296- "\\usepackage{makecell}",
2297- "\\usepackage{booktabs}",
2298-"\\usepackage{colortbl, xcolor}",
2299-"\\begin{document}",
2300-"\\thispagestyle{empty}",
2301-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
2302- ll,
2303- "\\end{document}"
2304- ),
2305- "table1_ms.tex"
2306-)
2307-
2308-
2309-
2310-tools::texi2pdf("table1_ms.tex", clean = TRUE)
2311-
2312-
2313-###########################à
2314-###########################à
2315-###########################à
2316-###########################à
2317-###########################à
2318-
2319-
2320-
2321-
2322-t1 <- budget_measure_ms %>%
2323- filter(member_state_2_letter_code %in% sel_ms) %>%
2324- arrange(desc(budget)) %>%
2325- mutate(share=share*100) %>%
2326- mutate(budget=format_col(budget, 1),
2327- share=format_col(share,2)) %>%
2328- mutate(share=paste(share, "%", sep="")) %>%
2329- move_row(1, nrow(.)) %>%
2330- mutate(type_of_measure=wrapper_text(type_of_measure,65)) %>%
2331- select(-member_state_2_letter_code)
2332-
2333-
2334-## t1 <- t1 %>%
2335-## bind_rows(t1)
2336-
2337-
2338-
2339-
2340-nn <- linebreak( c("Measure",
2341- "Allocated Budget\n(Million EUR)", "Share of\nTotal"
2342- ) ,
2343- align="c")
2344-
2345-
2346-t1_plot <- t1
2347-
2348-ll <- t1_plot %>%
2349- search_replace( "%", "\\\\%" ) %>%
2350- search_replace( "&", "\\\\&" ) %>%
2351- na_to_pattern(":") %>%
2352- pattern_to_pattern("NA", ":") %>%
2353-
2354- ## kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",6)),
2636+## t1 <- budget_type_ms %>%
2637+## filter(member_state_2_letter_code %in% sel_ms) %>%
2638+## select(name, budget, share) %>%
2639+## mutate(share=share*100) %>%
2640+## mutate(budget=format_col(budget, 1),
2641+## share=format_col(share,2)) %>%
2642+## mutate(share=paste(share, "%", sep="")) ## %>%
2643+## ## pattern_to_pattern("-", "Total EU")
2644+
2645+
2646+
2647+
2648+
2649+## nn <- linebreak( c("Case Type",
2650+## "Allocated Budget\n(Million EUR)", "Share of\nTotal"
2651+## ) ,
2652+## align="c")
2653+
2654+
2655+## t1_plot <- t1
2656+
2657+## ll <- t1_plot %>%
2658+## search_replace( "%", "\\\\%" ) %>%
2659+## na_to_pattern(":") %>%
2660+## pattern_to_pattern("NA", ":") %>%
2661+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
2662+## col.names = nn,
2663+## caption = paste(sel_ms,": Covid19 Allocated Budget by Case Type (Decided Cases)", sep="")
2664+## ) %>%
2665+## kable_styling(latex_options = c("striped", "hold_position"),
2666+## full_width = F## , font_size = 7
2667+## ) %>%
2668+## footnote(general=c(
2669+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
2670+## threeparttable = T) ## %>%
2671+## ## row_spec(pos, bold = T)
2672+
2673+
2674+
2675+
2676+
2677+## writeLines(
2678+## c(
2679+## "\\documentclass{article}",
2680+## "\\usepackage[a4paper]{geometry}",
2681+## "\\usepackage{helvet}",
2682+## "\\usepackage[flushleft]{threeparttable}" ,
2683+## "\\usepackage{graphicx}",
2684+## "\\renewcommand{\\familydefault}{\\sfdefault}",
2685+## "\\usepackage{caption}",
2686+## "\\usepackage[labelfont=bf,font=large]{caption}",
2687+## "\\usepackage{makecell}",
2688+## "\\usepackage{booktabs}",
2689+## "\\usepackage{colortbl, xcolor}",
2690+## "\\begin{document}",
2691+## "\\thispagestyle{empty}",
2692+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
2693+## ll,
2694+## "\\end{document}"
2695+## ),
2696+## "table1_ms.tex"
2697+## )
2698+
2699+
2700+
2701+## tools::texi2pdf("table1_ms.tex", clean = TRUE)
2702+
2703+
2704+## ###########################à
2705+## ###########################à
2706+## ###########################à
2707+## ###########################à
2708+## ###########################à
2709+
2710+
2711+
2712+
2713+## t1 <- budget_measure_ms %>%
2714+## filter(member_state_2_letter_code %in% sel_ms) %>%
2715+## arrange(desc(budget)) %>%
2716+## mutate(share=share*100) %>%
2717+## mutate(budget=format_col(budget, 1),
2718+## share=format_col(share,2)) %>%
2719+## mutate(share=paste(share, "%", sep="")) %>%
2720+## move_row(1, nrow(.)) %>%
2721+## mutate(type_of_measure=wrapper_text(type_of_measure,65)) %>%
2722+## select(-member_state_2_letter_code)
2723+
2724+
2725+## ## t1 <- t1 %>%
2726+## ## bind_rows(t1)
2727+
2728+
2729+
2730+
2731+## nn <- linebreak( c("Measure",
2732+## "Allocated Budget\n(Million EUR)", "Share of\nTotal"
2733+## ) ,
2734+## align="c")
2735+
2736+
2737+## t1_plot <- t1
2738+
2739+## ll <- t1_plot %>%
2740+## search_replace( "%", "\\\\%" ) %>%
2741+## search_replace( "&", "\\\\&" ) %>%
2742+## na_to_pattern(":") %>%
2743+## pattern_to_pattern("NA", ":") %>%
2744+
2745+## ## kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",6)),
23552746
23562747
2357- kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",2)),
2358- col.names = nn,
2359- caption = paste(sel_ms,": Covid19 Allocated Budget by Type of Measure (Decided Cases)", sep="")
2360- ) %>%
2361- kable_styling( position = "center",
2362- latex_options = c("repeat_header","striped" , "hold_position"),
2363- full_width = F) %>%
2364- footnote(general=c(
2365- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE) ## %>%
2366- ## row_spec(pos, bold = T)
2367-
2368-
2369-
2370-writeLines(
2371- c(
2372- "\\documentclass{article}",
2373- "\\usepackage[a4paper]{geometry}",
2374- "\\usepackage{longtable}",
2375- "\\usepackage{helvet}",
2376- "\\usepackage[flushleft]{threeparttable}" ,
2377- "\\usepackage{graphicx}",
2378- "\\usepackage{eurosym}",
2379- "\\renewcommand{\\familydefault}{\\sfdefault}",
2380- "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2381- "\\usepackage{makecell}",
2382- "\\usepackage{booktabs}",
2383-"\\usepackage{colortbl, xcolor}",
2384-"\\begin{document}",
2385-"\\pagestyle{empty}",
2386-"\\setlength{\\LTleft}{-20cm plus -1fill}",
2387-"\\setlength{\\LTright}{\\LTleft}",
2388-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
2389- ll,
2390- "\\end{document}"
2391- ),
2392- "table2_ms.tex"
2393-)
2394-
2395-
2396-
2397-tools::texi2pdf("table2_ms.tex", clean = TRUE)
2398-
2399-
2400-###########################à
2401-###########################à
2402-###########################à
2403-###########################à
2404-###########################à
2405-
2406-
2407-
2408-
2409-t1 <- budget_by_beneficiary_sector_ms %>%
2410- filter(member_state_2_letter_code %in% sel_ms) %>%
2411- mutate(share=share*100) %>%
2412- mutate(
2413- share=format_col(share,2)) %>%
2414- mutate(share=paste(share, "%", sep="")) %>%
2415- mutate(budget=format_col(budget,1)) %>%
2416- select(-member_state_2_letter_code)
2748+## kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",2)),
2749+## col.names = nn,
2750+## caption = paste(sel_ms,": Covid19 Allocated Budget by Type of Measure (Decided Cases)", sep="")
2751+## ) %>%
2752+## kable_styling( position = "center",
2753+## latex_options = c("repeat_header","striped" , "hold_position"),
2754+## full_width = F) %>%
2755+## footnote(general=c(
2756+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE) ## %>%
2757+## ## row_spec(pos, bold = T)
2758+
2759+
2760+
2761+## writeLines(
2762+## c(
2763+## "\\documentclass{article}",
2764+## "\\usepackage[a4paper]{geometry}",
2765+## "\\usepackage{longtable}",
2766+## "\\usepackage{helvet}",
2767+## "\\usepackage[flushleft]{threeparttable}" ,
2768+## "\\usepackage{graphicx}",
2769+## "\\usepackage{eurosym}",
2770+## "\\renewcommand{\\familydefault}{\\sfdefault}",
2771+## "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2772+## "\\usepackage{makecell}",
2773+## "\\usepackage{booktabs}",
2774+## "\\usepackage{colortbl, xcolor}",
2775+## "\\begin{document}",
2776+## "\\pagestyle{empty}",
2777+## "\\setlength{\\LTleft}{-20cm plus -1fill}",
2778+## "\\setlength{\\LTright}{\\LTleft}",
2779+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
2780+## ll,
2781+## "\\end{document}"
2782+## ),
2783+## "table2_ms.tex"
2784+## )
2785+
2786+
2787+
2788+## tools::texi2pdf("table2_ms.tex", clean = TRUE)
2789+
2790+
2791+## ###########################à
2792+## ###########################à
2793+## ###########################à
2794+## ###########################à
2795+## ###########################à
2796+
2797+
2798+
2799+
2800+## t1 <- budget_by_beneficiary_sector_ms %>%
2801+## filter(member_state_2_letter_code %in% sel_ms) %>%
2802+## mutate(share=share*100) %>%
2803+## mutate(
2804+## share=format_col(share,2)) %>%
2805+## mutate(share=paste(share, "%", sep="")) %>%
2806+## mutate(budget=format_col(budget,1)) %>%
2807+## select(-member_state_2_letter_code)
24172808
24182809
24192810
@@ -2422,603 +2813,591 @@
24222813
24232814
24242815
2425-nn <- linebreak( c("Sector",
2426- "Allocated Budget\n(Million EUR)", "Share of\nTotal"
2427- ) ,
2428- align="c")
2429-
2430-
2431-t1_plot <- t1
2432-
2433-ll <- t1_plot %>%
2434- search_replace( "%", "\\\\%" ) %>%
2435- search_replace( "&", "\\\\&" ) %>%
2436- na_to_pattern(":") %>%
2437- pattern_to_pattern("NA", ":") %>%
2438- pattern_to_pattern("NA", ":") %>%
2439- kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",11)),
2440- col.names = nn,
2441- caption = paste(sel_ms, ": Covid19 Allocated Budget by Sector",
2442- sep="")
2443- ) %>%
2444- kable_styling(latex_options = c("striped", "hold_position"),
2445- full_width = F## , font_size = 7
2446- ) %>%
2447- footnote(general=c(
2448- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE## ,
2449- ## threeparttable = T
2450- ) ## %>%
2451- ## row_spec(pos, bold = T)
2452-
2453-
2454-
2455-
2456-
2457-writeLines(
2458- c(
2459- "\\documentclass{article}",
2460- "\\usepackage[a4paper]{geometry}",
2461- "\\usepackage{longtable}",
2462- "\\usepackage{helvet}",
2463- "\\usepackage[flushleft]{threeparttable}" ,
2464- "\\usepackage{graphicx}",
2465- "\\usepackage{eurosym}",
2466- "\\renewcommand{\\familydefault}{\\sfdefault}",
2467- "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2468- "\\usepackage{makecell}",
2469- "\\usepackage{booktabs}",
2470-"\\usepackage{colortbl, xcolor}",
2471-"\\begin{document}",
2472-"\\pagestyle{empty}",
2473-"\\setlength{\\LTleft}{-20cm plus -1fill}",
2474-"\\setlength{\\LTright}{\\LTleft}",
2475-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
2476- ll,
2477- "\\end{document}"
2478- ),
2479- "table3_ms.tex"
2480-)
2481-
2482-
2483-
2484-
2485-
2486-
2487-
2488-tools::texi2pdf("table3_ms.tex", clean = TRUE)
2489-
2490-
2491-
2492-###########################à
2493-###########################à
2494-###########################à
2495-###########################à
2496-###########################à
2497-
2498-
2499-
2500-
2501-
2502-
2503-t1 <- budget_by_beneficiary_type_ms %>%
2504- filter(member_state_2_letter_code %in% sel_ms) %>%
2505- mutate(share=share*100) %>%
2506- mutate(
2507- share=format_col(share,2)) %>%
2508- mutate(share=paste(share, "%", sep="")) %>%
2509- mutate(budget=format_col(budget,1)) %>%
2510- select(-member_state_2_letter_code)
2511-
2512-
2513-
2514-
2515-
2516-
2517-
2518-
2519-
2520-
2521-nn <- linebreak( c("Beneficiary",
2522- "Allocated Budget\n(Million EUR)", "Share of\nTotal"
2523- ) ,
2524- align="c")
2525-
2526-
2527-t1_plot <- t1
2528-
2529-ll <- t1_plot %>%
2530- search_replace( "%", "\\\\%" ) %>%
2531- search_replace( "&", "\\\\&" ) %>%
2532- na_to_pattern(":") %>%
2533- pattern_to_pattern("NA", ":") %>%
2534- pattern_to_pattern("NA", ":") %>%
2535- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
2536- col.names = nn,
2537- caption = paste(sel_ms,": Covid19 Allocated Budget by Type of Beneficiary", sep="")
2538- ) %>%
2539- kable_styling(latex_options = c("striped", "hold_position"),
2540- full_width = F## , font_size = 7
2541- ) %>%
2542- footnote(general=c(
2543- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
2544- threeparttable = T
2545- ) ## %>%
2546- ## row_spec(pos, bold = T)
2547-
2548-
2549-
2550-
2551-
2552-writeLines(
2553- c(
2554- "\\documentclass{article}",
2555- "\\usepackage[a4paper]{geometry}",
2556- "\\usepackage{longtable}",
2557- "\\usepackage{helvet}",
2558- "\\usepackage[flushleft]{threeparttable}" ,
2559- "\\usepackage{graphicx}",
2560- "\\usepackage{eurosym}",
2561- "\\renewcommand{\\familydefault}{\\sfdefault}",
2562- "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2563- "\\usepackage{makecell}",
2564- "\\usepackage{booktabs}",
2565-"\\usepackage{colortbl, xcolor}",
2566-"\\begin{document}",
2567-"\\pagestyle{empty}",
2568-"\\setlength{\\LTleft}{-20cm plus -1fill}",
2569-"\\setlength{\\LTright}{\\LTleft}",
2570-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
2571- ll,
2572- "\\end{document}"
2573- ),
2574- "table4_ms.tex"
2575-)
2576-
2577-
2578-
2579-
2580-
2581-
2582-
2583-tools::texi2pdf("table4_ms.tex", clean = TRUE)
2584-
2585-
2586-###########################à
2587-###########################à
2588-###########################à
2589-###########################à
2590-###########################à
2591-
2592-
2593-t1 <- decisions_eu_ms %>%
2594- filter(member_state_2_letter_code %in% sel_ms) %>%
2595- mutate(share=share*100) %>%
2596- mutate(
2597- share=format_col(share,2)) %>%
2598- mutate(share=paste(share, "%", sep=""))%>%
2599- select(-member_state_2_letter_code)
2600-
2601-
2602-
2603-
2604-nn <- linebreak( c("Legal Basis",
2605- "Number of\nDecisions", "Share of\nTotal"
2606- ) ,
2607- align="c")
2608-
2609-
2610-t1_plot <- t1
2611-
2612-ll <- t1_plot %>%
2613- search_replace( "%", "\\\\%" ) %>%
2614- search_replace( "&", "\\\\&" ) %>%
2615- na_to_pattern(":") %>%
2616- pattern_to_pattern("NA", ":") %>%
2617- pattern_to_pattern("NA", ":") %>%
2618- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
2619- col.names = nn,
2620- caption = paste(sel_ms, ": Covid19 Decisions by Legal Basis (Decided Cases)", sep="")
2621- ) %>%
2622- kable_styling(latex_options = c("striped", "hold_position"),
2623- full_width = F## , font_size = 7
2624- ) %>%
2625- footnote(general=c(
2626- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
2627- threeparttable = T) ## %>%
2628- ## row_spec(pos, bold = T)
2629-
2630-
2631-
2632-
2633-
2634-writeLines(
2635- c(
2636- "\\documentclass{article}",
2637- "\\usepackage[a4paper]{geometry}",
2638- "\\usepackage{helvet}",
2639- "\\usepackage[flushleft]{threeparttable}" ,
2640- "\\usepackage{graphicx}",
2641- "\\renewcommand{\\familydefault}{\\sfdefault}",
2642- "\\usepackage{caption}",
2643- "\\usepackage[labelfont=bf,font=large]{caption}",
2644- "\\usepackage{makecell}",
2645- "\\usepackage{booktabs}",
2646-"\\usepackage{colortbl, xcolor}",
2647-"\\begin{document}",
2648-"\\thispagestyle{empty}",
2649-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
2650- ll,
2651- "\\end{document}"
2652- ),
2653- "table5_ms.tex"
2654-)
2655-
2656-
2657-
2658-tools::texi2pdf("table5_ms.tex", clean = TRUE)
2659-
2660-
2661-
2662-
2663-###########################à
2664-###########################à
2665-###########################à
2666-###########################à
2667-###########################à
2668-
2669-
2670-
2671-temp <- tibble(x=c("NO", "YES", "Total"), name=c("Under assessment", "Decided cases", "Total"))
2672-
2673-t1 <- sa_n_pn_ms %>%
2674- filter(member_state_2_letter_code %in% sel_ms) %>%
2675- left_join(y=temp, by=c("decided"="x")) %>%
2676- select(name, nn, share)%>%
2677- mutate(share=share*100) %>%
2678- mutate(
2679- share=format_col(share,2)) %>%
2680- mutate(share=paste(share, "%", sep="")) ## %>%
2681- ## select(-member_state_2_letter_code)
2682-
2683-
2684-
2685-nn <- linebreak( c("Case Assessment Status",
2686- "Number of\nCases", "Share of\nTotal"
2687- ) ,
2688- align="c")
2689-
2690-
2691-t1_plot <- t1
2692-
2693-ll <- t1_plot %>%
2694- search_replace( "%", "\\\\%" ) %>%
2695- search_replace( "&", "\\\\&" ) %>%
2696- na_to_pattern(":") %>%
2697- pattern_to_pattern("NA", ":") %>%
2698- pattern_to_pattern("NA", ":") %>%
2699- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
2700- col.names = nn,
2701- caption = paste(sel_ms, ": SA Case Assessment Pipeline\\\\Overview N and PN Cases", sep="")
2702- ) %>%
2703- kable_styling(latex_options = c("striped", "hold_position"),
2704- full_width = F## , font_size = 7
2705- ) %>%
2706- footnote(general=c(
2707- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
2708- threeparttable = T) ## %>%
2709- ## row_spec(pos, bold = T)
2710-
2711-
2712-
2713-
2714-
2715-writeLines(
2716- c(
2717- "\\documentclass{article}",
2718- "\\usepackage[a4paper]{geometry}",
2719- "\\usepackage{helvet}",
2720- "\\usepackage[flushleft]{threeparttable}" ,
2721- "\\usepackage{graphicx}",
2722- "\\renewcommand{\\familydefault}{\\sfdefault}",
2723- "\\usepackage{caption}",
2724- "\\usepackage[labelfont=bf,font=large]{caption}",
2725- "\\usepackage{makecell}",
2726- "\\usepackage{booktabs}",
2727-"\\usepackage{colortbl, xcolor}",
2728-"\\begin{document}",
2729-"\\thispagestyle{empty}",
2730-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
2731- ll,
2732- "\\end{document}"
2733- ),
2734- "table6_ms.tex"
2735-)
2736-
2737-
2738-
2739-tools::texi2pdf("table6_ms.tex", clean = TRUE)
2740-
2741-
2742-
2743-###########################à
2744-###########################à
2745-###########################à
2746-###########################à
2747-###########################à
2748-
2749-
2750-t1 <- measures_covid_ms %>%
2751- filter(member_state_2_letter_code %in% sel_ms) %>%
2752- mutate(share=share*100) %>%
2753- mutate(
2754- share=format_col(share,2)) %>%
2755- mutate(share=paste(share, "%", sep="")) %>%
2756- select(-member_state_2_letter_code)
2757-
2758-
2759-
2760-nn <- linebreak( c("Legal Basis",
2761- "Number of\nMeasures", "Share of\nTotal"
2762- ) ,
2763- align="c")
2764-
2765-
2766-t1_plot <- t1
2767-
2768-ll <- t1_plot %>%
2769- search_replace( "%", "\\\\%" ) %>%
2770- search_replace( "&", "\\\\&" ) %>%
2771- na_to_pattern(":") %>%
2772- pattern_to_pattern("NA", ":") %>%
2773- pattern_to_pattern("NA", ":") %>%
2774- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
2775- col.names = nn,
2776- caption = paste(sel_ms, ": Covid19 Measures by Legal Basis (Decided Cases)", sep="")
2777- ) %>%
2778- kable_styling(latex_options = c("striped", "hold_position"),
2779- full_width = F## , font_size = 7
2780- ) %>%
2781- footnote(general=c(
2782- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
2783- threeparttable = T) ## %>%
2784- ## row_spec(pos, bold = T)
2785-
2786-
2787-
2788-
2789-
2790-writeLines(
2791- c(
2792- "\\documentclass{article}",
2793- "\\usepackage[a4paper]{geometry}",
2794- "\\usepackage{helvet}",
2795- "\\usepackage[flushleft]{threeparttable}" ,
2796- "\\usepackage{graphicx}",
2797- "\\renewcommand{\\familydefault}{\\sfdefault}",
2798- "\\usepackage{caption}",
2799- "\\usepackage[labelfont=bf,font=large]{caption}",
2800- "\\usepackage{makecell}",
2801- "\\usepackage{booktabs}",
2802-"\\usepackage{colortbl, xcolor}",
2803-"\\begin{document}",
2804-"\\thispagestyle{empty}",
2805-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
2806- ll,
2807- "\\end{document}"
2808- ),
2809- "table7_ms.tex"
2810-)
2811-
2812-
2813-
2814-tools::texi2pdf("table7_ms.tex", clean = TRUE)
2815-
2816-
2817-####################################################################
2818-####################################################################
2819-####################################################################
2820-####################################################################
2821-####################################################################
2822-####################################################################
2823-
2824-
2825-
2826-
2827-
2828-temp <- tibble(x=c("TF1", "TF2", "TF3", "TF6", "TF7", "TF8", "TF9",
2829- "TF10", "TF11", "TF12", "Total"),
2830- name=c("3.1 Limited amount of aid", "3.2 Aid in the form of guarantees on loans", "3.3 Aid in the form of subsidised interest rates for loans",
2831- "3.6 Aid for COVID-19 relevant research and development",
2832- "3.7 Investment aid for testing and upscaling infrastructures",
2833- "3.8 Investment aid for the production of COVID-19 relevant products",
2834- "3.9 Aid in form of deferrals of tax and or social security contributions",
2835- "3.10 Aid in form of wage subsidies for employees to avoid lay-offs during the COVID-19 outbreak",
2836- "3.11 Recapitalisation measures for non-financial undertakings",
2837- "3.12 Support for uncovered fixed costs",
2838- "Total")
2839-
2840- )
2841-
2842-
2843-
2844-
2845-t1 <- chapters_stat_fin_ms %>%
2846- filter(member_state_code %in% sel_ms) %>%
2847- mutate(share=value/max(value) ) %>%
2848- left_join(y=temp, by=c("TF_chapter"="x")) %>%
2849- select(name, value, share) %>%
2850- mutate(share=share*100) %>%
2851- mutate(
2852- share=format_col(share,2)) %>%
2853- mutate(share=paste(share, "%", sep="")) %>%
2854- mutate(name=wrapper_text(name, 65))## %>%
2855- ## select(-member_state_code)
2856-
2857-nn <- linebreak( c("Chapter Description",
2858- "Frequency", "Share of\nTotal"
2859- ) ,
2860- align="c")
2861-
2862-
2863-t1_plot <- t1
2864-
2865-ll <- t1_plot %>%
2866- search_replace( "%", "\\\\%" ) %>%
2867- search_replace( "&", "\\\\&" ) %>%
2868- na_to_pattern(":") %>%
2869- pattern_to_pattern("NA", ":") %>%
2870- pattern_to_pattern("NA", ":") %>%
2871- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
2872- col.names = nn,
2873- caption = paste(sel_ms,": Frequency of Use of Temporary Framework Chapters", sep="")
2874- ) %>%
2875- kable_styling(latex_options = c("striped", "hold_position"),
2876- full_width = F## , font_size = 7
2877- ) %>%
2878- footnote(general=c(
2879- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
2880- threeparttable = T
2881- ) ## %>%
2882- ## row_spec(pos, bold = T)
2883-
2884-
2885-
2886-
2887-
2888-writeLines(
2889- c(
2890- "\\documentclass{article}",
2891- "\\usepackage[a4paper]{geometry}",
2892- "\\usepackage{longtable}",
2893- "\\usepackage{helvet}",
2894- "\\usepackage[flushleft]{threeparttable}" ,
2895- "\\usepackage{graphicx}",
2896- "\\usepackage{eurosym}",
2897- "\\renewcommand{\\familydefault}{\\sfdefault}",
2898- "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2899- "\\usepackage{makecell}",
2900- "\\usepackage{booktabs}",
2901-"\\usepackage{colortbl, xcolor}",
2902-"\\begin{document}",
2903-"\\pagestyle{empty}",
2904-"\\setlength{\\LTleft}{-20cm plus -1fill}",
2905-"\\setlength{\\LTright}{\\LTleft}",
2906-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
2907- ll,
2908- "\\end{document}"
2909- ),
2910- "table8_ms.tex"
2911-)
2912-
2913-
2914-
2915-
2916-
2917-
2918-
2919-tools::texi2pdf("table8_ms.tex", clean = TRUE)
2920-
2921-#########################################################
2922-
2923-
2924-t1 <- duration_stat_ms %>%
2925- filter(member_state_2_letter_code %in% sel_ms) %>%
2926- select(
2927- mean_duration, median_duration)
2928-
2929-t1_plot <- t1 %>%
2930- ## mutate(share=share*100) %>%
2931- ## mutate(budget=format_col(budget,1)) %>%
2932- ## mutate(share=round(share,1)) %>%
2933- ## mutate(share=format_col(share,1)) %>%
2934- ## mutate(share=paste(share,"%", sep="")) %>%
2935- ## mutate(gdp=paste(gdp,"%", sep="")) %>%
2936- mutate(mean_duration=format_col(mean_duration,1),
2937- median_duration=format_col(median_duration,1)
2938- ) ## %>%
2939- ## left_join(y=names, by=c("member_state_2_letter_code"="iso2")) %>%
2940- ## select(-member_state_2_letter_code) %>%
2941- ## select(country, everything())
2942-
2943-
2944-
2945-
2946-nn <- linebreak( c(
2947- "Mean Duration\n(calendar days)",
2948- "Median Duration\n(calendar days)") ,
2949- align="c")
2950-
2951-
2952-
2953-ll <- t1_plot %>%
2954- search_replace( "%", "\\\\%" ) %>%
2955- ## na_char_to_pattern(":") %>%
2956- ## pattern_to_pattern("NA", ":") %>%
2957- kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
2958- col.names = nn,
2959- caption = paste(sel_ms, ": Duration of Decisions")
2960- ) %>%
2961- kable_styling(latex_options = c("striped", "hold_position"),
2962- full_width = F## , font_size = 7
2963- ) %>%
2964- footnote(general=c(
2965- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
2966- threeparttable = T) ## %>%
2967- ## row_spec(pos, bold = T)
2968-
2969-
2970-
2971-
2972-writeLines(
2973- c(
2974- "\\documentclass{article}",
2975- "\\usepackage[a4paper]{geometry}",
2976- "\\usepackage{longtable}",
2977- "\\usepackage{helvet}",
2978- "\\usepackage[flushleft]{threeparttable}" ,
2979- "\\usepackage{graphicx}",
2980- "\\usepackage{eurosym}",
2981- "\\renewcommand{\\familydefault}{\\sfdefault}",
2982- "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2983- "\\usepackage{makecell}",
2984- "\\usepackage{booktabs}",
2985-"\\usepackage{colortbl, xcolor}",
2986-"\\begin{document}",
2987-"\\pagestyle{empty}",
2988-"\\setlength{\\LTleft}{-20cm plus -1fill}",
2989-"\\setlength{\\LTright}{\\LTleft}",
2990-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
2991- ll,
2992- "\\end{document}"
2993- ),
2994- "table9_ms.tex"
2995-)
2996-
2997-
2998-
2999-tools::texi2pdf("table9_ms.tex", clean = TRUE)
3000-
3001-
3002-##############################################################
3003-##############################################################
3004-##############################################################
3005-##############################################################
3006-
3007-
3008-
3009-rep1_unique_ms <- rep1_unique %>%
3010- filter(member_state_2_letter_code %in% sel_ms) %>%
3011- mutate(working_title=paste(case_reference, ": ", working_title)) %>%
3012- filter(!is.na(confirmed_budgets)) %>%
3013- mutate(decision_date=excel_numeric_to_date(decision_date)) %>%
3014- select(working_title, legal_basis,decision_date,
3015- confirmed_budgets,type_of_measure,beneficary_sector,
3016- beneficary_type) %>%
3017- mutate(confirmed_budgets=format_col(confirmed_budgets,1)) %>%
3018- mutate(working_title=convert_to_utf(working_title))
3019-
3020-
3021-## table_cases <- rep1_unique %>%
2816+## nn <- linebreak( c("Sector",
2817+## "Allocated Budget\n(Million EUR)", "Share of\nTotal"
2818+## ) ,
2819+## align="c")
2820+
2821+
2822+## t1_plot <- t1
2823+
2824+## ll <- t1_plot %>%
2825+## search_replace( "%", "\\\\%" ) %>%
2826+## search_replace( "&", "\\\\&" ) %>%
2827+## na_to_pattern(":") %>%
2828+## pattern_to_pattern("NA", ":") %>%
2829+## pattern_to_pattern("NA", ":") %>%
2830+## kable("latex",longtable = T, booktabs = T, escape = F,align=c("l", rep("r",11)),
2831+## col.names = nn,
2832+## caption = paste(sel_ms, ": Covid19 Allocated Budget by Sector",
2833+## sep="")
2834+## ) %>%
2835+## kable_styling(latex_options = c("striped", "hold_position"),
2836+## full_width = F## , font_size = 7
2837+## ) %>%
2838+## footnote(general=c(
2839+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE## ,
2840+## ## threeparttable = T
2841+## ) ## %>%
2842+## ## row_spec(pos, bold = T)
2843+
2844+
2845+
2846+
2847+
2848+## writeLines(
2849+## c(
2850+## "\\documentclass{article}",
2851+## "\\usepackage[a4paper]{geometry}",
2852+## "\\usepackage{longtable}",
2853+## "\\usepackage{helvet}",
2854+## "\\usepackage[flushleft]{threeparttable}" ,
2855+## "\\usepackage{graphicx}",
2856+## "\\usepackage{eurosym}",
2857+## "\\renewcommand{\\familydefault}{\\sfdefault}",
2858+## "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2859+## "\\usepackage{makecell}",
2860+## "\\usepackage{booktabs}",
2861+## "\\usepackage{colortbl, xcolor}",
2862+## "\\begin{document}",
2863+## "\\pagestyle{empty}",
2864+## "\\setlength{\\LTleft}{-20cm plus -1fill}",
2865+## "\\setlength{\\LTright}{\\LTleft}",
2866+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
2867+## ll,
2868+## "\\end{document}"
2869+## ),
2870+## "table3_ms.tex"
2871+## )
2872+
2873+
2874+
2875+
2876+
2877+
2878+
2879+## tools::texi2pdf("table3_ms.tex", clean = TRUE)
2880+
2881+
2882+
2883+## ###########################à
2884+## ###########################à
2885+## ###########################à
2886+## ###########################à
2887+## ###########################à
2888+
2889+
2890+
2891+
2892+
2893+
2894+## t1 <- budget_by_beneficiary_type_ms %>%
2895+## filter(member_state_2_letter_code %in% sel_ms) %>%
2896+## mutate(share=share*100) %>%
2897+## mutate(
2898+## share=format_col(share,2)) %>%
2899+## mutate(share=paste(share, "%", sep="")) %>%
2900+## mutate(budget=format_col(budget,1)) %>%
2901+## select(-member_state_2_letter_code)
2902+
2903+
2904+
2905+
2906+
2907+
2908+
2909+
2910+
2911+
2912+## nn <- linebreak( c("Beneficiary",
2913+## "Allocated Budget\n(Million EUR)", "Share of\nTotal"
2914+## ) ,
2915+## align="c")
2916+
2917+
2918+## t1_plot <- t1
2919+
2920+## ll <- t1_plot %>%
2921+## search_replace( "%", "\\\\%" ) %>%
2922+## search_replace( "&", "\\\\&" ) %>%
2923+## na_to_pattern(":") %>%
2924+## pattern_to_pattern("NA", ":") %>%
2925+## pattern_to_pattern("NA", ":") %>%
2926+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
2927+## col.names = nn,
2928+## caption = paste(sel_ms,": Covid19 Allocated Budget by Type of Beneficiary", sep="")
2929+## ) %>%
2930+## kable_styling(latex_options = c("striped", "hold_position"),
2931+## full_width = F## , font_size = 7
2932+## ) %>%
2933+## footnote(general=c(
2934+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
2935+## threeparttable = T
2936+## ) ## %>%
2937+## ## row_spec(pos, bold = T)
2938+
2939+
2940+
2941+
2942+
2943+## writeLines(
2944+## c(
2945+## "\\documentclass{article}",
2946+## "\\usepackage[a4paper]{geometry}",
2947+## "\\usepackage{longtable}",
2948+## "\\usepackage{helvet}",
2949+## "\\usepackage[flushleft]{threeparttable}" ,
2950+## "\\usepackage{graphicx}",
2951+## "\\usepackage{eurosym}",
2952+## "\\renewcommand{\\familydefault}{\\sfdefault}",
2953+## "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
2954+## "\\usepackage{makecell}",
2955+## "\\usepackage{booktabs}",
2956+## "\\usepackage{colortbl, xcolor}",
2957+## "\\begin{document}",
2958+## "\\pagestyle{empty}",
2959+## "\\setlength{\\LTleft}{-20cm plus -1fill}",
2960+## "\\setlength{\\LTright}{\\LTleft}",
2961+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
2962+## ll,
2963+## "\\end{document}"
2964+## ),
2965+## "table4_ms.tex"
2966+## )
2967+
2968+
2969+
2970+
2971+
2972+
2973+
2974+## tools::texi2pdf("table4_ms.tex", clean = TRUE)
2975+
2976+
2977+## ###########################à
2978+## ###########################à
2979+## ###########################à
2980+## ###########################à
2981+## ###########################à
2982+
2983+
2984+## t1 <- decisions_eu_ms %>%
2985+## filter(member_state_2_letter_code %in% sel_ms) %>%
2986+## mutate(share=share*100) %>%
2987+## mutate(
2988+## share=format_col(share,2)) %>%
2989+## mutate(share=paste(share, "%", sep=""))%>%
2990+## select(-member_state_2_letter_code)
2991+
2992+
2993+
2994+
2995+## nn <- linebreak( c("Legal Basis",
2996+## "Number of\nDecisions", "Share of\nTotal"
2997+## ) ,
2998+## align="c")
2999+
3000+
3001+## t1_plot <- t1
3002+
3003+## ll <- t1_plot %>%
3004+## search_replace( "%", "\\\\%" ) %>%
3005+## search_replace( "&", "\\\\&" ) %>%
3006+## na_to_pattern(":") %>%
3007+## pattern_to_pattern("NA", ":") %>%
3008+## pattern_to_pattern("NA", ":") %>%
3009+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
3010+## col.names = nn,
3011+## caption = paste(sel_ms, ": Covid19 Decisions by Legal Basis (Decided Cases)", sep="")
3012+## ) %>%
3013+## kable_styling(latex_options = c("striped", "hold_position"),
3014+## full_width = F## , font_size = 7
3015+## ) %>%
3016+## footnote(general=c(
3017+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
3018+## threeparttable = T) ## %>%
3019+## ## row_spec(pos, bold = T)
3020+
3021+
3022+
3023+
3024+
3025+## writeLines(
3026+## c(
3027+## "\\documentclass{article}",
3028+## "\\usepackage[a4paper]{geometry}",
3029+## "\\usepackage{helvet}",
3030+## "\\usepackage[flushleft]{threeparttable}" ,
3031+## "\\usepackage{graphicx}",
3032+## "\\renewcommand{\\familydefault}{\\sfdefault}",
3033+## "\\usepackage{caption}",
3034+## "\\usepackage[labelfont=bf,font=large]{caption}",
3035+## "\\usepackage{makecell}",
3036+## "\\usepackage{booktabs}",
3037+## "\\usepackage{colortbl, xcolor}",
3038+## "\\begin{document}",
3039+## "\\thispagestyle{empty}",
3040+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
3041+## ll,
3042+## "\\end{document}"
3043+## ),
3044+## "table5_ms.tex"
3045+## )
3046+
3047+
3048+
3049+## tools::texi2pdf("table5_ms.tex", clean = TRUE)
3050+
3051+
3052+
3053+
3054+## ###########################à
3055+## ###########################à
3056+## ###########################à
3057+## ###########################à
3058+## ###########################à
3059+
3060+
3061+
3062+## temp <- tibble(x=c("NO", "YES", "Total"), name=c("Under assessment", "Decided cases", "Total"))
3063+
3064+## t1 <- sa_n_pn_ms %>%
3065+## filter(member_state_2_letter_code %in% sel_ms) %>%
3066+## left_join(y=temp, by=c("decided"="x")) %>%
3067+## select(name, nn, share)%>%
3068+## mutate(share=share*100) %>%
3069+## mutate(
3070+## share=format_col(share,2)) %>%
3071+## mutate(share=paste(share, "%", sep="")) ## %>%
3072+## ## select(-member_state_2_letter_code)
3073+
3074+
3075+
3076+## nn <- linebreak( c("Case Assessment Status",
3077+## "Number of\nCases", "Share of\nTotal"
3078+## ) ,
3079+## align="c")
3080+
3081+
3082+## t1_plot <- t1
3083+
3084+## ll <- t1_plot %>%
3085+## search_replace( "%", "\\\\%" ) %>%
3086+## search_replace( "&", "\\\\&" ) %>%
3087+## na_to_pattern(":") %>%
3088+## pattern_to_pattern("NA", ":") %>%
3089+## pattern_to_pattern("NA", ":") %>%
3090+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
3091+## col.names = nn,
3092+## caption = paste(sel_ms, ": SA Case Assessment Pipeline\\\\Overview N and PN Cases", sep="")
3093+## ) %>%
3094+## kable_styling(latex_options = c("striped", "hold_position"),
3095+## full_width = F## , font_size = 7
3096+## ) %>%
3097+## footnote(general=c(
3098+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
3099+## threeparttable = T) ## %>%
3100+## ## row_spec(pos, bold = T)
3101+
3102+
3103+
3104+
3105+
3106+## writeLines(
3107+## c(
3108+## "\\documentclass{article}",
3109+## "\\usepackage[a4paper]{geometry}",
3110+## "\\usepackage{helvet}",
3111+## "\\usepackage[flushleft]{threeparttable}" ,
3112+## "\\usepackage{graphicx}",
3113+## "\\renewcommand{\\familydefault}{\\sfdefault}",
3114+## "\\usepackage{caption}",
3115+## "\\usepackage[labelfont=bf,font=large]{caption}",
3116+## "\\usepackage{makecell}",
3117+## "\\usepackage{booktabs}",
3118+## "\\usepackage{colortbl, xcolor}",
3119+## "\\begin{document}",
3120+## "\\thispagestyle{empty}",
3121+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
3122+## ll,
3123+## "\\end{document}"
3124+## ),
3125+## "table6_ms.tex"
3126+## )
3127+
3128+
3129+
3130+## tools::texi2pdf("table6_ms.tex", clean = TRUE)
3131+
3132+
3133+
3134+## ###########################à
3135+## ###########################à
3136+## ###########################à
3137+## ###########################à
3138+## ###########################à
3139+
3140+
3141+## t1 <- measures_covid_ms %>%
3142+## filter(member_state_2_letter_code %in% sel_ms) %>%
3143+## mutate(share=share*100) %>%
3144+## mutate(
3145+## share=format_col(share,2)) %>%
3146+## mutate(share=paste(share, "%", sep="")) %>%
3147+## select(-member_state_2_letter_code)
3148+
3149+
3150+
3151+## nn <- linebreak( c("Legal Basis",
3152+## "Number of\nMeasures", "Share of\nTotal"
3153+## ) ,
3154+## align="c")
3155+
3156+
3157+## t1_plot <- t1
3158+
3159+## ll <- t1_plot %>%
3160+## search_replace( "%", "\\\\%" ) %>%
3161+## search_replace( "&", "\\\\&" ) %>%
3162+## na_to_pattern(":") %>%
3163+## pattern_to_pattern("NA", ":") %>%
3164+## pattern_to_pattern("NA", ":") %>%
3165+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
3166+## col.names = nn,
3167+## caption = paste(sel_ms, ": Covid19 Measures by Legal Basis (Decided Cases)", sep="")
3168+## ) %>%
3169+## kable_styling(latex_options = c("striped", "hold_position"),
3170+## full_width = F## , font_size = 7
3171+## ) %>%
3172+## footnote(general=c(
3173+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
3174+## threeparttable = T) ## %>%
3175+## ## row_spec(pos, bold = T)
3176+
3177+
3178+
3179+
3180+
3181+## writeLines(
3182+## c(
3183+## "\\documentclass{article}",
3184+## "\\usepackage[a4paper]{geometry}",
3185+## "\\usepackage{helvet}",
3186+## "\\usepackage[flushleft]{threeparttable}" ,
3187+## "\\usepackage{graphicx}",
3188+## "\\renewcommand{\\familydefault}{\\sfdefault}",
3189+## "\\usepackage{caption}",
3190+## "\\usepackage[labelfont=bf,font=large]{caption}",
3191+## "\\usepackage{makecell}",
3192+## "\\usepackage{booktabs}",
3193+## "\\usepackage{colortbl, xcolor}",
3194+## "\\begin{document}",
3195+## "\\thispagestyle{empty}",
3196+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
3197+## ll,
3198+## "\\end{document}"
3199+## ),
3200+## "table7_ms.tex"
3201+## )
3202+
3203+
3204+
3205+## tools::texi2pdf("table7_ms.tex", clean = TRUE)
3206+
3207+
3208+## ####################################################################
3209+## ####################################################################
3210+## ####################################################################
3211+## ####################################################################
3212+## ####################################################################
3213+## ####################################################################
3214+
3215+
3216+
3217+
3218+
3219+## temp <- tibble(x=c("TF1", "TF2", "TF3", "TF6", "TF7", "TF8", "TF9",
3220+## "TF10", "TF11", "TF12", "Total"),
3221+## name=c("3.1 Limited amount of aid", "3.2 Aid in the form of guarantees on loans", "3.3 Aid in the form of subsidised interest rates for loans",
3222+## "3.6 Aid for COVID-19 relevant research and development",
3223+## "3.7 Investment aid for testing and upscaling infrastructures",
3224+## "3.8 Investment aid for the production of COVID-19 relevant products",
3225+## "3.9 Aid in form of deferrals of tax and or social security contributions",
3226+## "3.10 Aid in form of wage subsidies for employees to avoid lay-offs during the COVID-19 outbreak",
3227+## "3.11 Recapitalisation measures for non-financial undertakings",
3228+## "3.12 Support for uncovered fixed costs",
3229+## "Total")
3230+
3231+## )
3232+
3233+
3234+
3235+
3236+## t1 <- chapters_stat_fin_ms %>%
3237+## filter(member_state_code %in% sel_ms) %>%
3238+## mutate(share=value/max(value) ) %>%
3239+## left_join(y=temp, by=c("TF_chapter"="x")) %>%
3240+## select(name, value, share) %>%
3241+## mutate(share=share*100) %>%
3242+## mutate(
3243+## share=format_col(share,2)) %>%
3244+## mutate(share=paste(share, "%", sep="")) %>%
3245+## mutate(name=wrapper_text(name, 65))## %>%
3246+## ## select(-member_state_code)
3247+
3248+## nn <- linebreak( c("Chapter Description",
3249+## "Frequency", "Share of\nTotal"
3250+## ) ,
3251+## align="c")
3252+
3253+
3254+## t1_plot <- t1
3255+
3256+## ll <- t1_plot %>%
3257+## search_replace( "%", "\\\\%" ) %>%
3258+## search_replace( "&", "\\\\&" ) %>%
3259+## na_to_pattern(":") %>%
3260+## pattern_to_pattern("NA", ":") %>%
3261+## pattern_to_pattern("NA", ":") %>%
3262+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
3263+## col.names = nn,
3264+## caption = paste(sel_ms,": Frequency of Use of Temporary Framework Chapters", sep="")
3265+## ) %>%
3266+## kable_styling(latex_options = c("striped", "hold_position"),
3267+## full_width = F## , font_size = 7
3268+## ) %>%
3269+## footnote(general=c(
3270+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
3271+## threeparttable = T
3272+## ) ## %>%
3273+## ## row_spec(pos, bold = T)
3274+
3275+
3276+
3277+
3278+
3279+## writeLines(
3280+## c(
3281+## "\\documentclass{article}",
3282+## "\\usepackage[a4paper]{geometry}",
3283+## "\\usepackage{longtable}",
3284+## "\\usepackage{helvet}",
3285+## "\\usepackage[flushleft]{threeparttable}" ,
3286+## "\\usepackage{graphicx}",
3287+## "\\usepackage{eurosym}",
3288+## "\\renewcommand{\\familydefault}{\\sfdefault}",
3289+## "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
3290+## "\\usepackage{makecell}",
3291+## "\\usepackage{booktabs}",
3292+## "\\usepackage{colortbl, xcolor}",
3293+## "\\begin{document}",
3294+## "\\pagestyle{empty}",
3295+## "\\setlength{\\LTleft}{-20cm plus -1fill}",
3296+## "\\setlength{\\LTright}{\\LTleft}",
3297+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
3298+## ll,
3299+## "\\end{document}"
3300+## ),
3301+## "table8_ms.tex"
3302+## )
3303+
3304+
3305+
3306+
3307+
3308+
3309+
3310+## tools::texi2pdf("table8_ms.tex", clean = TRUE)
3311+
3312+## #########################################################
3313+
3314+
3315+## t1 <- duration_stat_ms %>%
3316+## filter(member_state_2_letter_code %in% sel_ms) %>%
3317+## select(
3318+## mean_duration, median_duration)
3319+
3320+## t1_plot <- t1 %>%
3321+## ## mutate(share=share*100) %>%
3322+## ## mutate(budget=format_col(budget,1)) %>%
3323+## ## mutate(share=round(share,1)) %>%
3324+## ## mutate(share=format_col(share,1)) %>%
3325+## ## mutate(share=paste(share,"%", sep="")) %>%
3326+## ## mutate(gdp=paste(gdp,"%", sep="")) %>%
3327+## mutate(mean_duration=format_col(mean_duration,1),
3328+## median_duration=format_col(median_duration,1)
3329+## ) ## %>%
3330+## ## left_join(y=names, by=c("member_state_2_letter_code"="iso2")) %>%
3331+## ## select(-member_state_2_letter_code) %>%
3332+## ## select(country, everything())
3333+
3334+
3335+
3336+
3337+## nn <- linebreak( c(
3338+## "Mean Duration\n(calendar days)",
3339+## "Median Duration\n(calendar days)") ,
3340+## align="c")
3341+
3342+
3343+
3344+## ll <- t1_plot %>%
3345+## search_replace( "%", "\\\\%" ) %>%
3346+## ## na_char_to_pattern(":") %>%
3347+## ## pattern_to_pattern("NA", ":") %>%
3348+## kable("latex", booktabs = T, escape = F,align=c("l", rep("r",11)),
3349+## col.names = nn,
3350+## caption = paste(sel_ms, ": Duration of Decisions")
3351+## ) %>%
3352+## kable_styling(latex_options = c("striped", "hold_position"),
3353+## full_width = F## , font_size = 7
3354+## ) %>%
3355+## footnote(general=c(
3356+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE,
3357+## threeparttable = T) ## %>%
3358+## ## row_spec(pos, bold = T)
3359+
3360+
3361+
3362+
3363+## writeLines(
3364+## c(
3365+## "\\documentclass{article}",
3366+## "\\usepackage[a4paper]{geometry}",
3367+## "\\usepackage{longtable}",
3368+## "\\usepackage{helvet}",
3369+## "\\usepackage[flushleft]{threeparttable}" ,
3370+## "\\usepackage{graphicx}",
3371+## "\\usepackage{eurosym}",
3372+## "\\renewcommand{\\familydefault}{\\sfdefault}",
3373+## "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
3374+## "\\usepackage{makecell}",
3375+## "\\usepackage{booktabs}",
3376+## "\\usepackage{colortbl, xcolor}",
3377+## "\\begin{document}",
3378+## "\\pagestyle{empty}",
3379+## "\\setlength{\\LTleft}{-20cm plus -1fill}",
3380+## "\\setlength{\\LTright}{\\LTleft}",
3381+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
3382+## ll,
3383+## "\\end{document}"
3384+## ),
3385+## "table9_ms.tex"
3386+## )
3387+
3388+
3389+
3390+## tools::texi2pdf("table9_ms.tex", clean = TRUE)
3391+
3392+
3393+## ##############################################################
3394+## ##############################################################
3395+## ##############################################################
3396+## ##############################################################
3397+
3398+
3399+
3400+## rep1_unique_ms <- rep1_unique %>%
30223401 ## filter(member_state_2_letter_code %in% sel_ms) %>%
30233402 ## mutate(working_title=paste(case_reference, ": ", working_title)) %>%
30243403 ## filter(!is.na(confirmed_budgets)) %>%
@@ -3026,87 +3405,99 @@
30263405 ## select(working_title, legal_basis,decision_date,
30273406 ## confirmed_budgets,type_of_measure,beneficary_sector,
30283407 ## beneficary_type) %>%
3029-## mutate(confirmed_budgets=format_col(confirmed_budgets,1))
3030-
3031-save_excel(rep1_unique_ms, "table_cases_MS.xlsx")
3408+## mutate(confirmed_budgets=format_col(confirmed_budgets,1)) %>%
3409+## mutate(working_title=convert_to_utf(working_title))
3410+
3411+
3412+## ## table_cases <- rep1_unique %>%
3413+## ## filter(member_state_2_letter_code %in% sel_ms) %>%
3414+## ## mutate(working_title=paste(case_reference, ": ", working_title)) %>%
3415+## ## filter(!is.na(confirmed_budgets)) %>%
3416+## ## mutate(decision_date=excel_numeric_to_date(decision_date)) %>%
3417+## ## select(working_title, legal_basis,decision_date,
3418+## ## confirmed_budgets,type_of_measure,beneficary_sector,
3419+## ## beneficary_type) %>%
3420+## ## mutate(confirmed_budgets=format_col(confirmed_budgets,1))
3421+
3422+## save_excel(rep1_unique_ms, "table_cases_MS.xlsx")
30323423
30333424
3034-t1_plot <- rep1_unique_ms %>%
3035- mutate(working_title=wrapper_text(working_title, 12)) %>%
3036- mutate(type_of_measure=wrapper_text(type_of_measure, 10)) %>%
3037- mutate(legal_basis=wrapper_text(legal_basis, 10)) %>%
3038- mutate(beneficary_sector=wrapper_text(beneficary_sector, 10)) %>%
3039- mutate(beneficary_type=wrapper_text(beneficary_type, 10))
3040-
3041-
3042-
3043-
3044-nn <- linebreak( c("Working\nTitle",
3045- "Legal\nBasis", "Decision\nDate",
3046- "Confirmed\nBudget",
3047- "Type of\nMeasure", "Beneficiary\nSector",
3048- "Beneficiary\nType") ,
3049- align="c")
3050-
3051-
3052-
3053-ll <- t1_plot %>%
3054- search_replace( "%", "\\\\%" ) %>%
3055- search_replace("_", " ") %>%
3056- search_replace("&", "and") %>%
3057- search_replace("/", " / ") %>%
3058-
3059- ## na_char_to_pattern(":") %>%
3060- ## pattern_to_pattern("NA", ":") %>%
3061- kable("latex",longtable = T, booktabs = T, escape = F,
3062- align=c("l", rep("r",11)),
3063- col.names = nn,
3064- caption = "EU Wide Statistics on Covid19 State Aid Measures"
3065- ) %>%
3066- kable_styling(position = "center",
3067- latex_options = c("repeat_header","striped", "hold_position"),
3068- full_width = F## , font_size = 7
3069- ) %>%
3070- footnote(general=c(
3071- "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE) ## %>%
3072- ## row_spec(pos, bold = T)
3073-
3074-
3075-
3076-
3077-
3078-
3079-
3080-
3081-writeLines(
3082- c(
3083- "\\documentclass{article}",
3084- "\\usepackage[a4paper]{geometry}",
3085- "\\usepackage{longtable}",
3086- "\\usepackage[utf8]{inputenc}",
3087- "\\usepackage{helvet}",
3088- "\\usepackage[flushleft]{threeparttable}" ,
3089- "\\usepackage{graphicx}",
3090- "\\usepackage{eurosym}",
3091- "\\renewcommand{\\familydefault}{\\sfdefault}",
3092- "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
3093- "\\usepackage{makecell}",
3094- "\\usepackage{booktabs}",
3095-"\\usepackage{colortbl, xcolor}",
3096-"\\begin{document}",
3097-"\\pagestyle{empty}",
3098-"\\setlength{\\LTleft}{-20cm plus -1fill}",
3099-"\\setlength{\\LTright}{\\LTleft}",
3100-"\\captionsetup[table]{labelformat=empty, textfont=bf}",
3101- ll,
3102- "\\end{document}"
3103- ),
3104- "table10_ms.tex"
3105-)
3106-
3107-
3108-
3109-## tools::texi2pdf("table10_ms.tex", clean = TRUE)
3425+## t1_plot <- rep1_unique_ms %>%
3426+## mutate(working_title=wrapper_text(working_title, 12)) %>%
3427+## mutate(type_of_measure=wrapper_text(type_of_measure, 10)) %>%
3428+## mutate(legal_basis=wrapper_text(legal_basis, 10)) %>%
3429+## mutate(beneficary_sector=wrapper_text(beneficary_sector, 10)) %>%
3430+## mutate(beneficary_type=wrapper_text(beneficary_type, 10))
3431+
3432+
3433+
3434+
3435+## nn <- linebreak( c("Working\nTitle",
3436+## "Legal\nBasis", "Decision\nDate",
3437+## "Confirmed\nBudget",
3438+## "Type of\nMeasure", "Beneficiary\nSector",
3439+## "Beneficiary\nType") ,
3440+## align="c")
3441+
3442+
3443+
3444+## ll <- t1_plot %>%
3445+## search_replace( "%", "\\\\%" ) %>%
3446+## search_replace("_", " ") %>%
3447+## search_replace("&", "and") %>%
3448+## search_replace("/", " / ") %>%
3449+
3450+## ## na_char_to_pattern(":") %>%
3451+## ## pattern_to_pattern("NA", ":") %>%
3452+## kable("latex",longtable = T, booktabs = T, escape = F,
3453+## align=c("l", rep("r",11)),
3454+## col.names = nn,
3455+## caption = "EU Wide Statistics on Covid19 State Aid Measures"
3456+## ) %>%
3457+## kable_styling(position = "center",
3458+## latex_options = c("repeat_header","striped", "hold_position"),
3459+## full_width = F## , font_size = 7
3460+## ) %>%
3461+## footnote(general=c(
3462+## "\\\\textit{Source}: COVID-19 State aid tracker."),general_title = " ", escape = FALSE) ## %>%
3463+## ## row_spec(pos, bold = T)
3464+
3465+
3466+
3467+
3468+
3469+
3470+
3471+
3472+## writeLines(
3473+## c(
3474+## "\\documentclass{article}",
3475+## "\\usepackage[a4paper]{geometry}",
3476+## "\\usepackage{longtable}",
3477+## "\\usepackage[utf8]{inputenc}",
3478+## "\\usepackage{helvet}",
3479+## "\\usepackage[flushleft]{threeparttable}" ,
3480+## "\\usepackage{graphicx}",
3481+## "\\usepackage{eurosym}",
3482+## "\\renewcommand{\\familydefault}{\\sfdefault}",
3483+## "\\usepackage[justification=centering,labelfont=bf,font=large]{caption}",
3484+## "\\usepackage{makecell}",
3485+## "\\usepackage{booktabs}",
3486+## "\\usepackage{colortbl, xcolor}",
3487+## "\\begin{document}",
3488+## "\\pagestyle{empty}",
3489+## "\\setlength{\\LTleft}{-20cm plus -1fill}",
3490+## "\\setlength{\\LTright}{\\LTleft}",
3491+## "\\captionsetup[table]{labelformat=empty, textfont=bf}",
3492+## ll,
3493+## "\\end{document}"
3494+## ),
3495+## "table10_ms.tex"
3496+## )
3497+
3498+
3499+
3500+## ## tools::texi2pdf("table10_ms.tex", clean = TRUE)
31103501
31113502
31123503
@@ -3118,11 +3509,11 @@
31183509
31193510
31203511
3121-fn <- paste("summary_tables_", sel_ms,"_generated_on_", Sys.Date(), ".pdf", sep="")
3122-
3123-system(paste("pdftk table1.pdf table1_ms.pdf table2_ms.pdf table3_ms.pdf table4_ms.pdf table5_ms.pdf table6_ms.pdf table7_ms.pdf table8_ms.pdf table9_ms.pdf cat output ", fn) )
3124-
3125-}
3512+## fn <- paste("summary_tables_", sel_ms,"_generated_on_", Sys.Date(), ".pdf", sep="")
3513+
3514+## system(paste("pdftk table1.pdf table1_ms.pdf table2_ms.pdf table3_ms.pdf table4_ms.pdf table5_ms.pdf table6_ms.pdf table7_ms.pdf table8_ms.pdf table9_ms.pdf cat output ", fn) )
3515+
3516+## }
31263517
31273518
31283519