Comprehensive Guide to evanverse"

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width = 7,
  fig.height = 5,
  fig.align = "center",
  warning = FALSE,
  message = FALSE
)

📖 Comprehensive Guide to evanverse

Welcome to the comprehensive guide for evanverse - a feature-rich R utility package providing 55+ functions for data analysis, visualization, and bioinformatics workflows.

🚀 Package Installation and Setup

# Install from CRAN
install.packages("evanverse")

# Or install development version from GitHub
evanverse::inst_pkg("evanbio/evanverse")
library(evanverse)

📦 Package Management

The evanverse package provides robust package management utilities:

# Check if packages are installed
required_packages <- c("dplyr", "ggplot2", "tidyr")
check_pkg(required_packages)

# Get package version (skip on CRAN due to network dependency)
if (!identical(Sys.getenv("NOT_CRAN"), "false")) {
  try(pkg_version("evanverse"), silent = TRUE)
}

🎨 Color Palette System

Available Palettes

# List all available palettes
palettes_info <- list_palettes()
print(palettes_info)

Using Color Palettes

# Get specific palettes
vivid_colors <- get_palette("qual_vivid", type = "qualitative")
blues_gradient <- get_palette("seq_blues", type = "sequential")

cat("Vivid qualitative palette:\n")
print(vivid_colors)

cat("\nBlues sequential palette:\n")
print(blues_gradient)

Creating Custom Palettes

# Create a custom palette (demonstration only - not executed to avoid file creation)
custom_colors <- c("#FF6B6B", "#4ECDC4", "#45B7D1", "#96CEB4")

# Example of how to create a custom palette (using temp directory):
# create_palette(
#   name = "custom_demo",
#   colors = custom_colors,
#   type = "qualitative",
#   color_dir = tempdir()  # Use temporary directory to avoid cluttering package
# )

# Preview the custom colors
print("Custom palette colors:")
print(custom_colors)
cat("This would create a palette named 'custom_demo' with", length(custom_colors), "colors\n")

📊 Visualization Functions

Venn Diagrams

# Create sample data for Venn diagram
set1 <- c("A", "B", "C", "D", "E")
set2 <- c("C", "D", "E", "F", "G")
set3 <- c("E", "F", "G", "H", "I")

# Create Venn diagram
venn_plot <- plot_venn(
  set1 = set1,
  set2 = set2,
  set3 = set3,
  category.names = c("Set1", "Set2", "Set3"),
  title = "Three-way Venn Diagram Example"
)
print(venn_plot)

Bar Plots

# Sample data
sample_data <- data.frame(
  Category = c("Type A", "Type B", "Type C"),
  Count = c(25, 18, 12),
  Group = c("High", "High", "Medium")
)

# Create bar plot with custom colors
vivid_colors <- get_palette("qual_vivid", type = "qualitative")
bar_plot <- plot_bar(data = sample_data,
                     x = "Category",
                     y = "Count",
                     fill = "Group") +
  ggplot2::scale_fill_manual(values = vivid_colors) +
  ggplot2::labs(title = "Sample Distribution by Category",
                x = "Sample Type",
                y = "Count")
print(bar_plot)

🧬 Bioinformatics Utilities

Gene ID Conversion

# Convert gene symbols to Ensembl IDs
gene_symbols <- c("TP53", "BRCA1", "EGFR")
ensembl_ids <- convert_gene_id(
  ids = gene_symbols,
  from = "SYMBOL",
  to = "ENSEMBL",
  species = "human"
)
print(ensembl_ids)

GMT File Processing

# Convert GMT file to data frame
gmt_df <- gmt2df("path/to/geneset.gmt")
head(gmt_df)

# Convert GMT file to list
gmt_list <- gmt2list("path/to/geneset.gmt")
length(gmt_list)

🔄 Data Processing and Void Handling

Working with Void Values

# Create sample vector with void values
messy_vector <- c("A", "", "C", NA, "E")

print("Original vector:")
print(messy_vector)

# Check for void values
cat("\nAny void values:", any_void(messy_vector), "\n")

# Replace void values
clean_vector <- replace_void(messy_vector, value = "MISSING")
print("After replacing voids:")
print(clean_vector)

Data Transformation

# Convert data frame to grouped list by cylinder count
grouped_data <- df2list(
  data = mtcars[1:10, ],
  key_col = "cyl",
  value_col = "mpg"
)

print("Cars grouped by cylinder, showing MPG values:")
str(grouped_data)

⚡ Custom Operators

# Demonstrate custom operators
x <- c(1, 2, 3, 4, 5)
y <- c(3, 4, 5, 6, 7)

# Check what's NOT in another vector
print(x %nin% y)

# Paste operator
result <- "Hello" %p% " " %p% "World"
print(result)

# Check identity
print(5 %is% 5)

💾 File Operations

Flexible File Reading

# Read various file formats flexibly
data1 <- read_table_flex("data.csv")
data2 <- read_excel_flex("data.xlsx", sheet = 1)

# Get file information
file_info("data.csv")

# Display directory tree
file_tree(".")

🛠️ Development Tools

Timing and Execution

# Time execution of code
result <- with_timer(function() {
  Sys.sleep(0.01)  # Quick simulation
  sum(1:1000)
}, name = "Sum calculation")

print(result)

Safe Execution

# Execute code safely
safe_result <- safe_execute({
  x <- 1:10
  mean(x)
})

print(safe_result)

📈 Summary

The evanverse package provides a comprehensive toolkit for:

With 55+ functions across 8 major categories, evanverse streamlines your data analysis workflow while maintaining flexibility and reliability.

🔗 Next Steps


For more information, visit the evanverse website or the GitHub repository.



Try the evanverse package in your browser

Any scripts or data that you put into this service are public.

evanverse documentation built on March 10, 2026, 5:07 p.m.