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
d <- "Date Word Pr. Corr. | |
19.01.23 py pwæ 0 | |
19.01.23 ka ka 1 | |
19.01.23 li li 1 | |
19.01.23 se sæ 0 | |
19.01.23 ba bae 0 | |
19.01.23 ju djul 0 | |
19.01.23 ty tæ 0 | |
19.01.23 pi pi 1 | |
19.01.23 se si 0 |
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
selfdestructor <- function(x) { | |
if (is.numeric(x)) { | |
fn <- paste0("selfdestructor_", x, "k") | |
} else { | |
fn <- paste0("selfdestructor_", x) | |
} | |
f <- function() { | |
message("You specified: x = ", x) | |
rm(list=fn, envir=.GlobalEnv) | |
message("Poof!") |
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
funfun <- function() { | |
x <- readline("What's your name?\n") | |
x0 <- sample(strsplit(tolower(x), NULL)[[1]]) | |
# number of possible unique permutations, taking account of | |
# non-distinct objects | |
np <- factorial(length(x0))/prod(factorial(table(x0))) | |
count <- 0 | |
rfunfun(x, np, count) | |
} |
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
#!/bin/bash | |
Dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
cd $Dir | |
echo "Enter commit message" | |
read Message | |
if [ -z "$Message" ] | |
then |
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
sides <- 8 | |
lim <- 6 | |
n <- 20 | |
lb <- 12 | |
ub <- 16 | |
pbinom(ub, n, (sides-lim)/sides) - pbinom(lb-1, n, (sides-lim)/sides) | |
# 0.000935362 |
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
javascript:Qr=prompt('S%C3%B8k%20i%20siden%20etter','');if(Qr)location.href='http://www.google.com/search?&q=site:'+encodeURIComponent(window.location.hostname)+'+'+escape(Qr) |
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
set.seed(1) | |
n <- 40 | |
p <- 0.3 | |
r <- 0.5 | |
m <- MASS::mvrnorm(n, c(0, 0), matrix(c(1, r, r, 1), 2)) | |
m <- t(t(m) * c(1, 2)) | |
m <- t(t(m) + c(51, 50)) | |
m <- round(m, 1) |
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
# tied greater than | |
`%tgt%` <- function(x, y) { | |
v <- x > y | |
v[x == y] <- 0.5 | |
v | |
} | |
tgt <- function(x, y) { | |
v <- x > y | |
v[x == y] <- 0.5 |
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
sampletext <- "Technically, five-bit codes began in the 17th century, when Francis Bacon developed the cipher now called Bacon's cipher. The cipher was not designed for machine telecommunications (it was instead a method of encrypting a hidden message into another) and, although in theory it could be adapted to that purpose, it only covered 24 of the 26 letters of the English alphabet (two sets of letters, I/J and U/V, were expressed with the same code) and contained no punctuation, spaces, numbers or control characters, rendering it of little use." | |
sampletext | |
#[1] "Technically, five-bit codes began in the 17th century, when Francis Bacon developed the cipher now called Bacon's cipher. The cipher was not designed for machine telecommunications (it was instead a method of encrypting a hidden message into another) and, although in theory it could be adapted to that purpose, it only covered 24 of the 26 letters of the English alphabet (two sets of letters, I/J and U/V, were expressed with the same code) and con |
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(caret) | |
set.seed(1) | |
val <- runif(200) | |
# val <- rnorm(200) | |
k <- 35 | |
length(val)/k | |
# 5.714286 |
NewerOlder