Skip to content

Instantly share code, notes, and snippets.

View Rekyt's full-sized avatar

Matthias Grenié Rekyt

View GitHub Profile
@Rekyt
Rekyt / workflow_reproducible_analysis.Rmd
Created March 13, 2017 08:47
My workflow for reproducible analysis
---
title: "Workflow for Reproductible Analysis"
author: "Matthias Grenié"
date: "8 mars 2017"
output: word_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
@Rekyt
Rekyt / ggtree_cladelabel.R
Created June 16, 2017 11:48
Automatic several clade label
library(ggtree)
set.seed(2017-05-19)
my_tree = rtree(50)
clade_df = data.frame(node = c(52, 71, 80, 94),
clade = paste0("clade_", 1:4),
color = rep(c("#000000", "#AAAAAA"), size = 4))
@Rekyt
Rekyt / ktab_pcoa.R
Created June 21, 2017 15:04
Simulation with binary & continuous traits to see PCoA
library(ade4)
library(dplyr)
n_species = 7000
trait_df = data.frame(
c_tr1 = rnorm(n_species),
c_tr2 = rnorm(n_species),
c_tr3 = rnorm(n_species),
c_tr4 = rnorm(n_species),
# Text analysis of Proust
library(proustr)
library(tidytext)
library(dplyr)
library(stringr)
proust_words = proust_books() %>%
group_by(book) %>%
mutate(linenumber = row_number(),
# Function to add number ontop of geom_boxplot
library(ggplot2)
library(dplyr)
# /!\ Need to manually change the "groups" if ks_test included
add_groups_and_number = function(given_plot, ks_tests) {
y_range = ggplot_build(given_plot)$layout$panel_params[[1]]$y.range
y_upper = max(y_range)
@Rekyt
Rekyt / arrow_pcoa.Rmd
Last active November 19, 2024 21:20
Plotting arrows on a PCoA
---
title: "Adding arrows to PCoA"
author: "Matthias Grenié"
date: "26 septembre 2018"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
@Rekyt
Rekyt / sfe_program.Rmd
Created October 17, 2018 10:00
Prettier Program for SFÉcologie 2018
---
title: "Prettier SFÉcologie 2018 Program"
author: "Matthias Grenié"
date: "17 octobre 2018"
header-includes:
- \usepackage{booktabs}
- \usepackage{longtable}
- \usepackage{array}
- \usepackage{multirow}
- \usepackage[table]{xcolor}
@Rekyt
Rekyt / phylo_traits_clade_label.Rmd
Created February 6, 2019 14:00
Plot a phylogeny with clade labels and colored edges programmatically
---
title: "Phylogeny with traits in branches and clade labels"
author: "Matthias Grenié"
date: /today
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
@Rekyt
Rekyt / plot_dependencies.R
Last active March 11, 2020 16:16
Plot dependency network copy-pasted from https://gist.github.com/crsh/c906e93c260488e7363ea606243057c2 but considered all dependencies
#' Plot network of package dependencies
#'
#' @param pkg package description, can be path or package name.
#' See \code{\link[devtools]{as.package}} for more information.
#' @param type which packages should be included in the network
#'
#' @details The resulting plot visualizes the network of package dependencies.
#' If you are trying to cut down on package dependencies look for big red
#' dots that represent a lot of upstream but few downstream dependencies.
#' @import ggplot2
@Rekyt
Rekyt / papaja_word_count.Rmd
Created February 18, 2019 17:32
Minimal Reprex Papaja Word Count
---
title : "How to use papaja: An Example Manuscript Including Basic Instructions"
shorttitle : "How to use papaja"
author:
- name : "Frederik Aust"
affiliation : "1"
corresponding : yes # Define only one corresponding author
address : "Department Psychology, University of Cologne, Herbert-Lewin-Str. 2, 50931 Köln, Germany"
email : "frederik.aust@uni-koeln.de"