Skip to content

Instantly share code, notes, and snippets.

View JGravier's full-sized avatar

Julie Gravier JGravier

View GitHub Profile
@JGravier
JGravier / EAA_cluster.R
Created August 25, 2023 12:29
functions of EAA presentation
# HCA on PCA coords: returning object hclust or object dendrogram
hca_on_pca <- function(df, objet, nclust){
pca_dudi <- ade4::dudi.pca(df = df, center = TRUE, scale = TRUE, scannf = FALSE, nf = ncol(df))
dist_pca <- ade4::dist.dudi(pca_dudi) # distance on coord of PCA indivuduals
clustering <- hclust(dist_pca, method = "ward.D2") # hca on distances
if (objet == TRUE) {
returning <- clustering
} else {
dendro <- as.dendrogram(clustering)
@JGravier
JGravier / permutation.qmd
Created January 5, 2023 15:28
example of permutation r
---
title: "Permutation"
author: "Julie Gravier"
date: "01/01/2023"
format:
html:
fig-width: 8
fig-height: 4
code-fold: false
---

Distances simulations between linear located elements and random point patterns in R

Julie Gravier 2022-09-29

Librairies required:

library(tidyverse) # or at least tidyr, dplyr and ggplot2 librairies
library(sf)