Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added JPG/Biomarker.ico
Binary file not shown.
Binary file added JPG/Biomarker.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/DataFakeR.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/GitStats.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/PharmaDevOps.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/RDO.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/Rbasel.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/StatisticalEngineering.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/StatisticalEngineering_test.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/TLG.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/admiral.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/bonsaiforest.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/cards.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/cardx.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/facetsr.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/ggplot2.utils.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/helios.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/jmpost.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/mmrm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/ocean.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/psborrow2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/sasr.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/simIDM.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/simaerep.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JPG/visR.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PNG/Biomarker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PNG/StatisticalEngineering_test.png
Binary file added PNG/TLG.png
Binary file added PNG/bonsaiforest.png
Binary file added PNG/cards.png
Binary file added PNG/cardx.png
Binary file added PNG/simIDM.png
980 changes: 980 additions & 0 deletions SVG/Biomarker.svg

Large diffs are not rendered by default.

1,495 changes: 1,495 additions & 0 deletions SVG/DataFakeR.svg

Large diffs are not rendered by default.

1,119 changes: 1,119 additions & 0 deletions SVG/GitStats.svg

Large diffs are not rendered by default.

2,608 changes: 2,608 additions & 0 deletions SVG/PharmaDevOps.svg

Large diffs are not rendered by default.

1,819 changes: 1,819 additions & 0 deletions SVG/RDO.svg

Large diffs are not rendered by default.

469 changes: 469 additions & 0 deletions SVG/Rbasel.svg

Large diffs are not rendered by default.

914 changes: 914 additions & 0 deletions SVG/TLG.svg

Large diffs are not rendered by default.

1,197 changes: 1,197 additions & 0 deletions SVG/admiral.svg

Large diffs are not rendered by default.

385 changes: 385 additions & 0 deletions SVG/bonsaiforest.svg

Large diffs are not rendered by default.

805 changes: 805 additions & 0 deletions SVG/cards.svg

Large diffs are not rendered by default.

804 changes: 804 additions & 0 deletions SVG/cardx.svg

Large diffs are not rendered by default.

621 changes: 621 additions & 0 deletions SVG/covtracer.svg

Large diffs are not rendered by default.

798 changes: 798 additions & 0 deletions SVG/crmPack.svg

Large diffs are not rendered by default.

1,474 changes: 1,474 additions & 0 deletions SVG/facetsr.svg

Large diffs are not rendered by default.

19,899 changes: 19,899 additions & 0 deletions SVG/ggplot2.utils.svg

Large diffs are not rendered by default.

719 changes: 719 additions & 0 deletions SVG/helios.svg

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions SVG/hermes.svg

Large diffs are not rendered by default.

12,887 changes: 12,887 additions & 0 deletions SVG/jmpost.svg

Large diffs are not rendered by default.

5,169 changes: 5,169 additions & 0 deletions SVG/ocean.svg

Large diffs are not rendered by default.

616 changes: 616 additions & 0 deletions SVG/pharmaverse.svg

Large diffs are not rendered by default.

7,904 changes: 7,904 additions & 0 deletions SVG/psborrow2.svg

Large diffs are not rendered by default.

646 changes: 646 additions & 0 deletions SVG/rbmi.svg

Large diffs are not rendered by default.

414 changes: 414 additions & 0 deletions SVG/simIDM.svg

Large diffs are not rendered by default.

444 changes: 444 additions & 0 deletions SVG/simaerep.svg

Large diffs are not rendered by default.

1,072 changes: 1,072 additions & 0 deletions SVG/staged.dependencies.svg

Large diffs are not rendered by default.

875 changes: 875 additions & 0 deletions SVG/thevalidatoR.svg

Large diffs are not rendered by default.

446 changes: 446 additions & 0 deletions SVG/visR.svg

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions scripts/convert_formats.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Professional Script for Automatic Logo Conversion

library("magick")

# Function to retrieve file information from a directory
get_file_info <- function(path) {
files <- list.files(path = path, full.names = TRUE, recursive = FALSE)
tools::file_path_sans_ext(basename(files))
}

# Get file names (sans extensions) from each format directory
svg_files <- get_file_info("SVG")
png_files <- get_file_info("PNG")
ico_files <- get_file_info("ICO")
jpg_files <- get_file_info("jpg")

# Consolidate all unique file names
all_icons <- unique(c(svg_files, png_files, ico_files, jpg_files))

# Create a dataframe indicating the presence of each format
icons_df <- data.frame(
icons = all_icons,
svg = tolower(all_icons) %in% tolower(svg_files),
png = tolower(all_icons) %in% tolower(png_files),
ico = tolower(all_icons) %in% tolower(ico_files),
jpg = tolower(all_icons) %in% tolower(jpg_files)
)

# Filter files that need conversion (not present in all formats less ICO)
files_to_convert <- icons_df[rowSums(icons_df[, -1]) < ncol(icons_df) - 2, ]

# Function to convert and save logos in missing formats
convert_logos <- function(row) {
file_name <- row["icons"]
available_formats <- names(row[-1])[unlist(row[-1])]
missing_formats <- setdiff(c("svg", "png", "jpg", "ico"), available_formats)

# Determine the best base format to use for conversion
format_preference <- c("svg", "jpg", "png", "ico")
min_match <- min(match(available_formats, format_preference), na.rm = TRUE)
base_format <- format_preference[min_match]

input_file <- file.path(toupper(base_format), paste0(file_name, ".", base_format))
image <- if (base_format == "svg") {
image_read_svg(input_file)
} else {
image_read(input_file)
}

missing_formats <- setdiff(missing_formats, "ico")
if (length(missing_formats) == 0L) {
invisible(return(NULL))
}
message("Converting ", file_name, " from ", base_format, " to ", paste(missing_formats, collapse = ", "))
for (format in missing_formats) {
if (format == "ico") next # Skip ICO conversion (optional handling)
output_file <- file.path(toupper(format), paste0(file_name, ".", format))
converted_image <- image_convert(image, format = format, matte = TRUE)
image_write(converted_image, path = output_file, format = format, depth = 8)
}

image_destroy(image)
}

# Perform conversion for each incomplete file
for (r in seq_len(nrow(files_to_convert))) {
convert_logos(files_to_convert[r, ])
}

# Move SVG logos to corresponding package directories
move_logos_to_packages <- function(path_pacakges = "..") {
svg_logos <- list.files("SVG", full.names = TRUE, recursive = FALSE)
package_dirs <- list.dirs(path_pacakges, recursive = FALSE)
package_dirs <- package_dirs[!endsWith(package_dirs, ".Rcheck")]

logo_names <- tools::file_path_sans_ext(basename(svg_logos))
matching_packages <- intersect(tolower(logo_names), basename(package_dirs))

destination_paths <- file.path(path_pacakges, matching_packages, "man", "figures", "logo.svg")
origin_paths <- svg_logos[tools::file_path_sans_ext(basename(svg_logos)) %in% matching_packages]

valid_destinations <- dir.exists(dirname(destination_paths)) & !file.exists(destination_paths)

if (any(valid_destinations)) {
message("Copying to", paste(destination_paths[valid_destinations], collapse = ", "))
file.copy(from = origin_paths[valid_destinations], to = destination_paths[valid_destinations])
}

# Remove existing PNG logos if applicable
png_logos <- file.path(path_pacakges, matching_packages, "man", "figures", "logo.png")
if (any(file.exists(png_logos))) {
message("Removing ", paste(png_logos[file.exists(png_logos)], collapse = ", "))
file.remove(png_logos[file.exists(png_logos)])
}
}

move_logos_to_packages()
Loading