Skip to content

Commit

Permalink
Commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
FerreiraAS committed Sep 28, 2024
1 parent 5df1660 commit d55eff6
Show file tree
Hide file tree
Showing 18 changed files with 1,898 additions and 247 deletions.
Binary file modified .DS_Store
Binary file not shown.
10 changes: 3 additions & 7 deletions 1_inicio.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,6 @@ has.agendas.pesquisa <-
silent = TRUE))
```

```{r try-apresentacao}
has.apresentacao <-
!BBmisc::is.error(try(readxl::read_excel("PPG/Apresentação.xlsx", sheet = 1),
silent = TRUE))
```

```{r try-area-capes}
has.area.capes <-
!BBmisc::is.error(try(readxl::read_excel("PPG/Área CAPES.xlsx", sheet = 1),
Expand Down Expand Up @@ -707,7 +701,6 @@ has.ppg.files <- as.logical(has.ppg.files)
# PPG files
has.agendas.pesquisa <- as.logical(has.agendas.pesquisa)
has.apresentacao <- as.logical(has.apresentacao)
has.area.capes <- as.logical(has.area.capes)
has.autoavaliacao <- as.logical(has.autoavaliacao)
has.avaliacao <- as.logical(has.avaliacao)
Expand Down Expand Up @@ -746,6 +739,9 @@ has.repositorios.sede <- as.logical(has.repositorios.sede)
has.metricas.doi.sucupira <- as.logical(has.metricas.doi.sucupira)
has.metricas.doi.ppg <- as.logical(has.metricas.doi.ppg)
# has.posdoc
has.posdoc <- as.logical(has.posdoc)
# has.tables
has.table.msc <- FALSE
has.table.dsc <- FALSE
Expand Down
Binary file modified PPG/Images/Cover-1.pdf
Binary file not shown.
Binary file modified PPG/Images/Cover-2.pdf
Binary file not shown.
18 changes: 10 additions & 8 deletions Scripts/all-required-packages.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ packs.cran <-
"ggpubr",
"ggraph",
"ggtext",
"ggwordcloud",
"grid",
"gridExtra",
"gtsummary",
Expand Down Expand Up @@ -76,13 +77,13 @@ packs.cran <-
"terra",
"tidyverse",
"tinytable",
"tinytex",
"tm",
"tools",
"units",
"usethis",
"vioplot",
"webshot2",
"wordcloud2",
"yaml"
)

Expand Down Expand Up @@ -147,6 +148,14 @@ if (curl::has_internet()) {
pacman::p_load_gh("trinker/textreadr")
}


# update TeX packages
tinytex::tlmgr_update()

# install missing TeX packages
try(tinytex::parse_install("./autoavaliacao.log"), silent = TRUE)
try(tinytex::parse_packages("./autoavaliacao.log"), silent = TRUE)

# update all packages
update.packages(checkBuilt = TRUE, ask = FALSE)
}
Expand All @@ -157,10 +166,3 @@ packs <- unique(c(packs.cran, packs.git))
for (i in 1:length(packs)) {
library(packs[i], character.only = TRUE)
}

# update TeX packages
tinytex::tlmgr_update()

# install missing TeX packages
try(tinytex::parse_install("./autoavaliacao.log"), silent = TRUE)
try(tinytex::parse_packages("./autoavaliacao.log"), silent = TRUE)
104 changes: 37 additions & 67 deletions Scripts/docs-to-wordcloud.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,71 +27,41 @@ if (clean.text == TRUE) {
df$freq <- rank(df$freq, ties.method = "first")
}

# set plot area
par(
oma = c(0, 0, 0, 0),
mar = c(0, 0, 0, 0),
bg = main.color,
col.lab = "white",
col.axis = "white",
fg = "white",
col.main = "white"
)
# generate word cloud
if (length(df) != 0) {
wordcloud <- wordcloud2::wordcloud2(
data = df,
size = 0.5,
color = rep(
RColorBrewer::brewer.pal(n = 9, name = "Set3"),
length.out = length(df$freq)
),
backgroundColor = main.color,
shuffle = FALSE,
rotateRatio = 0,
ellipticity = 0.5
) %>%
htmlwidgets::prependContent(
htmltools::tags$h1(style = "position:absolute; left:50%; transform:translateX(-50%); background-color:main.color; font-size:40px; color:white; line-height:normal;", cloud.title)
) %>%
htmlwidgets::prependContent(
htmltools::tags$body(style = "font-family:'Lato','Helvetica Neue',Helvetica, Arial,sans-serif; background-color:main.color; margin:0; padding:0;")
)
# save it in html
htmlwidgets::saveWidget(wordcloud, file.path(dir.path, "tmp.html"), selfcontained = F)

# deactivate the crash reporter
old_chrome_args <- chromote::get_chrome_args()
chromote::set_chrome_args("--disable-crash-reporter")
Sys.setenv(CHROMOTE_CHROME = chromote::find_chrome())

# and in png
webshot2::webshot(
url = file.path("file:///", dir.path, "tmp.html"),
file = file.path(dir.path, paste0(sheet, ".png")),
delay = 5,
vwidth = round(1344 * 0.7),
vheight = round(960 * 0.7)
)
# delete the tmp folder and file
unlink(file.path(dir.path, "tmp_files"), recursive = TRUE)
unlink(file.path(dir.path, "tmp.html"))

# Restore old defaults
chromote::set_chrome_args(old_chrome_args)
} else {
source("Scripts/plot-margins.R", local = knitr::knit_global())
# plot area setup
par(mar = c(1.5, 15, 1, 1))

layout.m <- c(1)
png(file.path(dir.path, paste0(sheet, ".png")), width = round(1344 * 0.7), height = round(960 * 0.7))
source("Scripts/plot-margins.R", local = knitr::knit_global())
plot(0, type = 'n', axes = FALSE)
title(
main = sheet,
outer = TRUE,
cex.main = 3
)
dev.off()
# ensure produção bibliográfica e técnica are displayed
n.max <- 100
if (nrow(df) > n.max) {
df <- df[1:n.max, ]
}

# generate word cloud using ggplot
wordcloud <-
ggplot2::ggplot(df, ggplot2::aes(
label = word,
size = freq,
color = factor(as.character(freq))
)) +
ggwordcloud::geom_text_wordcloud(
rm_outside = TRUE,
max_steps = 1,
grid_size = 1,
eccentricity = .9
) +
ggplot2::scale_size_area(max_size = 10) +
ggplot2::theme_minimal() +
ggplot2::theme(
plot.margin = ggplot2::unit(c(0.5, 0, 0, 0), "cm"),
panel.background = ggplot2::element_rect(fill = main.color, color = main.color),
plot.background = ggplot2::element_rect(fill = main.color, color = main.color),
panel.grid.major = ggplot2::element_line(color = "transparent"),
axis.text.x = ggplot2::element_blank(),
axis.text.y = ggplot2::element_blank(),
plot.title = ggplot2::element_text(
hjust = 0.5,
size = 11,
color = "white",
face = "bold"
),
text = ggplot2::element_text(color = "white")
) +
ggplot2::scale_color_brewer(palette = "Blues", direction = -1) +
ggplot2::ggtitle(cloud.title)
2 changes: 1 addition & 1 deletion autoavaliacao.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -1796,7 +1796,7 @@ for (i in 1:length(lista.AC.LP)) {
```

<!--- knit those table chunk statements -->
`r if(has.sucupira.files){paste(knit(text = out), collapse = '\n\n')}`
`r if(has.sucupira.files){paste(knitr::knit(text = out), collapse = '\n\n')}`

\elandscape

Expand Down
Loading

0 comments on commit d55eff6

Please sign in to comment.