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
#include <stdio.h> | |
void put_character(char); | |
void end_line(); | |
char mask_bit(char, char); | |
int main() { | |
char a_character; | |
a_character = -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
#include <stdio.h> | |
void put_character(char); | |
char mask_bit(char a_char, char bit); | |
void end_line() { | |
printf("\n"); | |
} |
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
#include <stdio.h> | |
void put_character(char); | |
int main() { | |
put_character(5); | |
end_line(); | |
return 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
library(mice) | |
# y is function of x | |
x <- rnorm(100) | |
y <- x + rnorm(100, sd=.5) | |
# make some ys missing | |
y[sample(length(y), 10)] <- NA | |
dframe <- data.frame(y=y, x=x) |
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(dplyr) | |
data_url <- "https://github.com/3inar/crime_rates/raw/master/src/data/norwegian_crime.rda" | |
load(url(data_url)) | |
violent <- norwegian_crime %>% filter(crime_type=="¬ Vold og mishandling", year==2014) | |
violent <- violent %>% mutate(rate=reports/population) | |
hist(violent$rate) |
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
# source: | |
# https://en.wikipedia.org/wiki/List_of_United_States_federal_funding_gaps | |
budget_gaps <- matrix(c( | |
12, 0, | |
14, 0, | |
10, 0, | |
10, 0, | |
19, 0, | |
13, 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
library(ProjectTemplate); load.project() | |
library(plyr) | |
crime_type <- "¬ Vold og mishandling" | |
towns <- mean_crimes(crime_type) | |
counts <- simulate_crimes(towns$population, towns$cpp, law="binomial") | |
data <- tibble(rate=counts/towns$population, population=towns$population, reports=counts) | |
data <- as.tibble(cbind(data, stats(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(plyr) | |
library(MASS) | |
test <- raply(50000, { | |
dat <- mvrnorm(200, mu = c(0,1), Sigma = matrix(c(1,.3,.3,1), nrow=2)) | |
y <- dat[,1] | |
x <- dat[,2] | |
# throw away most of the data, introduce huge bias | |
y <- y[x > 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
library(pmadsim) | |
library(curveselection) | |
library(plyr) | |
library(ktspair) | |
lambdas <- 1/seq(0.01, 2, length.out = 10) | |
res <- aaply(lambdas, 1, function(lambda2) { | |
raply(1000, { | |
d <- simulation(lambda2=lambda2) |
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
expression <- exprs(gene_expression) | |
expression_se <- se.exprs(gene_expression) | |
detection <- detection(gene_expression) | |
control_data <- controlData(gene_expression) | |
write.csv(expression, file="for_submission/expression.csv") | |
write.csv(expression_se, file="for_submission/expression_se.csv") | |
write.csv(detection, file="for_submission/detection.csv") | |
write.csv(control_data, file="for_submission/control_data.csv") |
NewerOlder