We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing new features
- Becoming a maintainer
library(ggplot2) | |
library(dplyr) | |
library(tidyr) | |
library(purrr) | |
library(scales) | |
library(patchwork) | |
theme_set(theme_minimal()) | |
# define functions ------------------------------------------------------------- |
library(dplyr) # for data wrangling | |
library(tidyr) # same | |
library(purrr) # for functional programming | |
library(rlang) # for tidyeval | |
library(ggplot2) # for dataviz | |
library(ggsci) # for nice colours | |
library(scales) # for displaying percentages | |
library(brms) # for Bayesian models | |
library(tidybayes) # for extracting posterior draws and predictions | |
library(yardstick) # for generating ROC curves |
from machine import Pin, PWM | |
from time import sleep | |
# Create a dictionary of Morse Code. s is for Short (or dots), l is for Long (or dashes) | |
MorseCodes = { | |
' ': '', | |
'a': 'sl', | |
'b': 'lsss', | |
'c': 'lsls', | |
'd': 'lss', |
# get audio duration | |
# set up ---- | |
library(audio) | |
library(purrr) | |
library(dplyr) | |
library(tidyr) | |
library(ggplot2) | |
library(PraatR) | |
library(stringr) |
# animate the Beta distribution | |
# parameter vectors | |
x = collect(0.01:0.01:0.99); # sampling space | |
α = collect(0.1:0.1:10); | |
β = collect(0.1:0.1:10); | |
# only β=5 is used, but I don't want to mess up the code | |
# extract probability densities for all combinations of parameters | |
y = zeros(length(x), length(α), length(β)); # pre-alocate |
# extract lexical frequencies from CHILDES | |
# you may need to install the following packages: | |
# install.packages(c("dplyr", "stringr", "tidyr", "chidesr")) | |
get_childes_frequency <- function( | |
token, # word(s) form to look up, e.g. c("table", "mesa") | |
languages = c("cat", "spa"), # languages in which to look up the word form | |
... # other arguments (see ?childesr::get_speaker_statistics) | |
){ |
#### 2020-10-17-visualising-polynomial-regression ----- | |
#### set up ------------------------------------------- | |
# load packages | |
library(tidyverse) | |
library(gganimate) | |
library(data.table) | |
library(magick) | |
library(here) |
#### mask ---------------------------------------------------------------------- | |
# import packages | |
library(tidyverse) | |
library(readxl) | |
library(stringdist) | |
#### import data --------------------------------------------------------------- | |
# you can download the data from https://drive.google.com/file/d/18SeJTiM2-JXR9SOqEg22wdkvNL3OxG3u/view?usp=sharing |
library(tidyverse) | |
library(gganimate) | |
x <- seq(-4*pi, 4*pi, by = pi/50) | |
k <- seq(4*pi, -4*pi, by = -pi/50) | |
y <- t(sapply(x, function(x) sin(x-k))) | |
d <- as.data.frame(cbind(as.matrix(x), y)) | |
colnames(d) <- c("x", k) | |
d <- pivot_longer(d, -x, "k", values_to = "y") %>% | |
mutate_at(vars(k), as.numeric) |