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(shiny) | |
ui = fluidPage( | |
titlePanel("My favorite movies"), | |
hr(), | |
# ------------------------------------- # | |
# Input form | |
tags$h3("Input form"), | |
fluidRow( |
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
""" | |
A Simple Snake clone using tkinter | |
Author: Christian König | |
Date created: 09.09.2021 | |
Python Version: 3.8.6 | |
""" | |
import tkinter as tk | |
import random |
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
thin_coordinates = function(coords, threshold){ | |
# Function for faster spatial thinning of coordinates | |
# coords: geographic coordinates in lon/lat format | |
# threshold: minimum distance between points in meters | |
coords_dist = geosphere::distm(coords, fun = distHaversine) # Great circle distance between points | |
coords_dist[upper.tri(coords_dist, diag = T)] = NA # Triangular distance matrix | |
coords_flagged = which(coords_dist < threshold, arr.ind=TRUE) # Two-column matrix of coordinate-pairs that are below threshold | |
pts_remove = c() | |
while(nrow(coords_flagged) > 0){ |
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
OrigValueStr | dispersal_syndrome | n | |
---|---|---|---|
'Probably' Pongo pygmaeus | NA | 1 | |
(water) | hydrochorous | 9 | |
(water?) | hydrochorous | 1 | |
0 | unspecialized | 7172 | |
0.2 | NA | 5 | |
0.25 | NA | 6 | |
0.333333333 | NA | 19 | |
0.5 | NA | 31 | |
0.6 | NA | 2 |
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
OrigValueStr | pollination_syndrome | n | |
---|---|---|---|
1 | abiotic | 11 | |
2 | abiotic | 16 | |
3 | biotic | 4 | |
abio | abiotic | 39 | |
Anemofila | abiotic | 4 | |
anemogamous | abiotic | 246 | |
anemogamous/entomogamous | abiotic | 35 | |
Animals | biotic | 58 | |
Animals Wind | NA | 3 |
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
graph_to_newick = function(graph, root){ | |
##### Define callback functions for DFS | |
# 1. function to be called whenever a vertex is visited | |
f.in <- function(graph, data, extra) { | |
curr_node = extra$names[data['vid']+1] # Get vertex name (Add 1 to index because igraph uses 0-based indexing) | |
prev_node = extra$order.in[which(extra$order.in == curr_node)-1] | |
next_node = extra$order.out[which(extra$order.out == curr_node)+1] | |
if(length(extra$distances[prev_node]) == 0){ # first node / root | |
cat("") | |
} else{ |