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(reshape2) | |
N <- 100000L | |
d.m <- data.frame(q1=runif(N), q2=runif(N), q3=runif(N), | |
f=sample(letters, N, replace=T), w=runif(N)) | |
print(head(d.m)) | |
print(summary(d.m)) | |
sessionInfo() |
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: "Test" | |
output: html_document | |
--- | |
```{r setup} | |
knitr::dep_prev() | |
summary(cars) | |
``` |
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
m1 <- png::readPNG("~/Downloads/m1.png") | |
m2 <- png::readPNG("~/Downloads/m2.png") | |
m1r <- m1[,,1] | |
m2r <- m2[,,1] | |
m1r1 <- m1r[,1] | |
m2r1 <- m2r[,1] | |
sim <- llply( |
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
curl http://krlmlr.github.io/makeR/install | sh | |
make dt_test | |
make init-wercker | |
make init-gh-pages |
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
all: results.log | |
results.log: benchmark.R Makefile | |
r -p benchmark.R | tee results.log |
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
cut2 <- function (x, breaks, labels = NULL, include.lowest = FALSE, right = TRUE, | |
dig.lab = 3, ordered_result = FALSE, ...) | |
{ | |
if (!is.numeric(x)) | |
stop("'x' must be numeric") | |
if (length(breaks) == 1L) { | |
if (is.na(breaks) || breaks < 2L) | |
stop("invalid number of intervals") | |
nb <- as.integer(breaks + 1) | |
dx <- diff(rx <- range(x, na.rm = TRUE)) |
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
dat <- read.table(text="VARIABLES DATE DATA | |
V1 1/03/2012 1000 | |
V1 1/04/2012 1500 | |
V1 1/12/2012 2600 | |
V2 1/03/2012 900 | |
V2 1/04/2012 1200 | |
V2 1/12/2012 1000 | |
V3 1/03/2012 200", header = TRUE) |
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
# Auto-screen invocation. see: http://taint.org/wk/RemoteLoginAutoScreen | |
# if we're coming from a remote SSH connection, in an interactive session | |
# then automatically put us into a screen(1) session. Only try once | |
# -- if $STARTED_SCREEN is set, don't try it again, to avoid looping | |
# if screen fails for some reason. | |
if [ "$TERM" != screen -a "$PS1" != "" -a "${STARTED_SCREEN:-x}" = x -a "${SSH_TTY:-x}" != x -a "$DISPLAY" == "" ] | |
then | |
echo "Auto-starting screen." | |
# Set the window title to HOSTNAME |
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
DROP TABLE IF EXISTS ind1_2000 CASCADE; | |
CREATE TABLE ind1_2000 (id integer, ind1 float); | |
ALTER TABLE ind1_2000 ADD PRIMARY KEY (id); | |
INSERT INTO ind1_2000 VALUES (1, 0.0); | |
INSERT INTO ind1_2000 VALUES (2, 0.3); | |
INSERT INTO ind1_2000 VALUES (3, 1.1); | |
VACUUM ANALYZE ind1_2000; | |
DROP TABLE IF EXISTS ind2_2000 CASCADE; | |
CREATE TABLE ind2_2000 (id integer, ind2 float); |
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
template <class Fun> | |
class ScopeGuard { | |
Fun f_; | |
bool active_; | |
public: | |
ScopeGuard(Fun f) | |
: f_(std::move(f)) | |
, active_(true) { | |
} | |
~ScopeGuard() { if (active_) f_(); } |
OlderNewer