This file contains 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(tidyverse) | |
library(ggdist) | |
# make some data | |
expand_grid( | |
condition = c("A", "B"), | |
stimulus = seq(-3,3,0.3), | |
repetitions = 1:20 | |
) %>% | |
# make some noisy response data |
This file contains 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(geojsonsf) | |
library(sf) | |
library(rayrender) | |
#Data source: https://github.com/telegeography/www.submarinecablemap.com | |
cables = geojson_sf("cable-geo.json") | |
cablescene = list() | |
counter = 1 | |
for(i in 1:length(cables$geometry)) { |
This file contains 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(tidyverse) | |
library(ggsankey) | |
## data via https://ourworldindata.org/grapher/total-agricultural-area-over-the-long-term | |
hablar::set_wd_to_script_path() | |
df <- | |
read_csv("total-agricultural-area-over-the-long-term.csv") %>% | |
janitor::clean_names() %>% |
This file contains 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
--- | |
title: "DKB Export Cleanup" | |
author: "Frie" | |
date: "10/10/2020" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) | |
library(purrr) |
This file contains 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(tidyverse) | |
library(msthemes) | |
library(sf) | |
# GeoJSON: http://opendatalab.de/projects/geojson-utilities/ | |
geodat <- st_read("landkreise_simplify200.geojson", quiet=TRUE, stringsAsFactors=FALSE) %>% | |
mutate( | |
center = map(geometry, st_centroid), | |
centercoord = map(center, st_coordinates), |
This file contains 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
# License: Apache 2.0 | |
# A straightforward translation of the Python code: | |
turbo_colormap_data <- matrix( | |
c( | |
c(0.18995, 0.07176, 0.23217), | |
c(0.19483, 0.08339, 0.26149), | |
c(0.19956, 0.09498, 0.29024), | |
c(0.20415, 0.10652, 0.31844), |
This file contains 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
# ======================================= | |
# = Enhancements to data tidying = | |
# = Hadley Wickham = | |
# = https://rstd.io/tidyhancements-2019 = | |
# ======================================= | |
# What is tidy data? ---------------------------------------------------------- | |
# 1. Each column is a variable. | |
# 2. Each row is an observation. | |
# 3. Each cell is a value. |
This file contains 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 relevant packages | |
library(NCmisc) | |
library(stringr) | |
# Load the script and parse lines | |
file_name <- "example_script.R" | |
file_lines <- readLines(file_name) | |
# Save the function and package names | |
functions_list <- list.functions.in.file(file_name) |
This file contains 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
# Download earth data first | |
# https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_land.zip | |
library(sf) | |
library(lwgeom) | |
library(dplyr) | |
library(ggplot2) | |
library(mapview) | |
# Read the data |
This file contains 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
#' Download files from Zenodo record id | |
#' | |
#' @param record_id record id | |
#' @param dest_folder destination folder for file downloads | |
#' @param token API key | |
#' | |
#' @details https://github.com/zenodo/zenodo/issues/1629#issuecomment-435062462 | |
#' | |
#' @importFrom httr GET content | |
#' @importFrom jsonlite fromJSON |
NewerOlder