library(tidyverse)
library(widyr)
library(maps)
#>
#> Attaching package: 'maps'
#> The following object is masked from 'package:purrr':
#>
#> map
eurovision_votes <- read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-05-17/eurovision-votes.csv')
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) | |
| gm_2023 <- readr::read_csv("https://www.cedricscherer.com/data/gapminder-2023.csv") | |
| pal <- c(Africa = "#00D9EE", Americas = "#4CF101", Asia = "#FF4670", Europe = "#FFE702", Oceania = "#CA4ADC") | |
| # base plot | |
| g <- | |
| ggplot(gm_2023, aes(x = gdp_pcap, y = life_exp, size = pop)) + | |
| geom_point( | |
| color = "white", |
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
| data(diamonds, package = "ggplot2") | |
| # Most straightforward | |
| diamonds$ppc <- diamonds$price / diamonds$carat | |
| # Avoid repeating diamonds | |
| diamonds$ppc <- with(diamonds, price / carat) | |
| # The inspiration for dplyr's mutate | |
| diamonds <- transform(diamonds, ppc = price / carat) |
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(gt) | |
| library(gtExtras) | |
| library(dplyr) | |
| library(htmltools) | |
| # original source: https://www.bloomberg.com/graphics/2021-german-election-results/ | |
| party_df <- tibble( | |
| Party = c("SPD", "CDU/CSU", "Greens", "FDP", "AfD", "Left", "Other"), | |
| Seats = c(206, 196, 118, 92, 83, 39, 1), |
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
| # What's the most natural way to express this code in base R? | |
| library(dplyr, warn.conflicts = FALSE) | |
| mtcars %>% | |
| group_by(cyl) %>% | |
| summarise(mean = mean(disp), n = n()) | |
| #> # A tibble: 3 x 3 | |
| #> cyl mean n | |
| #> <dbl> <dbl> <int> | |
| #> 1 4 105. 11 | |
| #> 2 6 183. 7 |
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(ggtree) | |
| library(emojifont) | |
| tree_text <- "(evergreen_tree,(avocado,((tulip, ( palm_tree, ( banana, ( pineapple, (corn, ( tanabata_tree, ear_of_rice )))))),((grapes, (((peanuts, shamrock), ((( rose, strawberry ), ((apple, pear ), ( peach, (cherry_blossom, cherries) ))), (chestnut, (jack_o_lantern, (watermelon, (cucumber, melon)))))), (hibiscus, (( tangerine, lemon ), (maple_leaf))))),(cactus, (kiwi_fruit, ((sweet_potato, (hot_pepper, (eggplant, (potato, tomato)))), (carrot,(sunflower, blossom)))))))));" | |
| x <- read.tree(text=tree_text) | |
| ggtree(x, layout="circular") + | |
| xlim(NA, 13) + ylim(NA, 39) + | |
| geom_tiplab(aes(color=label), parse='emoji', size=6, vjust=0.5, hjust = 0.5, offset = 0.6) + |
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
| #theme and ggplot derived from David Kretch, his code: https://github.com/davidkretch/london_cholera_map/blob/master/london_cholera_map.R | |
| library(HistData) | |
| library(ggplot2) | |
| library(ggpointdensity) | |
| library(rayshader) | |
| deaths = Snow.deaths | |
| streets = Snow.streets |
Job script:
#!/bin/bash
#SBATCH --job-name=rfee
#SBATCH --workdir=/home/user.name/rfee/
#SBATCH --output=r_foreach_example_console_output.txt
#SBATCH --mem-per-cpu=100 # specify RAM per CPU here in Mb
#SBATCH --time=0:02:00
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
| ############################################################################ | |
| # estimation via the base R optim function | |
| # code adapted from Farrell & Lewandowsky (2018, ch.3) | |
| # https://github.com/psy-farrell/computational-modelling | |
| ################################################################# | |
| library(hrbrthemes) | |
| library(tidyverse) | |
| library(gganimate) | |
| library(magick) |
| layout | title | date | excerpt |
|---|---|---|---|
posts |
Visualizing Genome Annotations |
2019-01-25 |
Creating a UCSC Genome Track for Viewing Genome Annotations |
When creating a custom, in-house genome annotation, there is no straight-forward way to share it upon publication. NCBI does not accept and archive these, so most users just end up depositing the text files in an online repository. The UCSC Genome Browser team has fortunately come up with a decent way to share an annotation in a graphical manner, so readers can browse the assembly and annotation at some level without a lot of work.
NewerOlder