π§βπ»
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ============================================================================ | |
| # R Package Installation Guide | |
| # Data Visualization and Genomics Course | |
| # ============================================================================ | |
| # | |
| # This script will help you install all required R packages for the course. | |
| # | |
| # Prerequisites: | |
| # - R version: 4.3.0 or higher (recommended: 4.4.0+) | |
| # - RStudio: Latest version recommended |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| demo_font_text <- function( | |
| google_names, | |
| families = tolower(gsub("\\s+", "", google_names)), | |
| label_text = "Showtext shows text. Wow. What an insight.", | |
| size = 13 | |
| ) { | |
| # dependencies | |
| library(showtext) | |
| library(ggplot2) | |
| library(dplyr) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Load the Rcpp library (assuming you've already loaded it earlier) | |
| library(Rcpp) | |
| library(showtext) | |
| library(ggplot2) | |
| library(ggforce) | |
| library(ggfx) | |
| ## Loading Google fonts (https://fonts.google.com/) | |
| font_add_google("Exo 2", "Exo") | |
| showtext_auto() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(ggplot2) | |
| library(dplyr, warn.conflicts = FALSE) | |
| tibble(species=c(rep("tiger",2),rep("elephant",2)), | |
| type=rep(c("upregulated","downregulated"),2), | |
| counts=c(121,117,219,234)) %>% | |
| ggplot() + | |
| geom_col(aes(species,counts,fill=type), position = position_dodge()) + | |
| scale_fill_manual(values=c("#ffa345","#624185")) + | |
| geom_text(aes(x=species, y=counts+5, label=counts, group=type), position = position_dodge(width = 0.9)) + # Here, do not forget to GROUP! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Load required packages | |
| library(tidyverse) | |
| library(gridExtra) | |
| library(showtext) | |
| library(grid) | |
| # Read the global temperature data from CSV file | |
| global_temps <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-07-11/global_temps.csv') | |
| # Add custom font and enable automatic text rendering |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # βββββββ ββββββββββββ βββ βββββββ βββ ββββββββββ βββ | |
| # βββββββββββββββββββββ βββββββββββ βββ βββββββββββ βββ | |
| # ββββββββββββββ ββββββ ββββββ βββββββ ββββββββββββ βββ | |
| # βββββββ ββββββ βββββββββββββ ββββββ ββββββββββββββββ | |
| # βββ βββββββββββ ββββββββββββββββββββββββββββββ ββββββ | |
| # βββ βββββββββββ βββββ βββββββ βββββββ ββββββ βββββ | |
| # | |
| ############# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| colorDNASequences <- function(dna_sequences) { | |
| # Define background colors for bases | |
| base_backgrounds <- c(A = "\033[41m", T = "\033[42m", G = "\033[44m", C = "\033[43m") # Red, Green, Blue, Yellow background | |
| # Iterate over each DNA sequence | |
| for (dna_sequence in dna_sequences) { | |
| # Convert the sequence to uppercase to handle both upper and lower case letters | |
| sequence <- toupper(dna_sequence) | |
| # Iterate over each base in the sequence |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| colorDNASequences <- function(dna_sequences) { | |
| # Define colors for bases | |
| base_colors <- c(A = "\033[31m", T = "\033[32m", G = "\033[34m", C = "\033[33m") # Red, Green, Blue, Yellow | |
| gap <- " " # Tiny gap between base pairs | |
| # Iterate over each DNA sequence | |
| for (dna_sequence in dna_sequences) { | |
| # Convert the sequence to uppercase to handle both upper and lower case letters | |
| sequence <- toupper(dna_sequence) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(showtext) | |
| library(ggplot2) | |
| ## Loading Google fonts (https://fonts.google.com/) | |
| font_add_google("Exo 2", "Exo") | |
| ## Automatically use showtext to render text | |
| showtext_auto() | |
| generate_lines_within_circle <- function(center_x, center_y, radius, num_lines) { | |
| start_angles <- runif(num_lines, 0, 2 * pi) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(showtext) | |
| library(ggplot2) | |
| library(ggforce) | |
| library(tibble) | |
| library(ltc) | |
| library(showtext) | |
| ## Loading Google fonts (https://fonts.google.com/) | |
| font_add_google("Great Vibes", "Great Vibes") |
NewerOlder