Last active
August 6, 2018 10:27
-
-
Save earcanal/3e705805cc8b92ccc4a12a94b66bae6f to your computer and use it in GitHub Desktop.
Randomise experiment factory participants by token
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
# $ ssh $HOST 'docker exec container expfactory users --list' | grep active | cut -f 2 | perl -lne's/(.*)\[active\]/$1/g; print' > docker/tokens | |
library(tidyverse) | |
tokens <- read.table('data/tokens') %>% | |
rename(token = V1) | |
N=nrow(tokens) | |
set.seed(54321) | |
participants <- expand.grid(k=1:N, condition=c("experimental","control")) %>% | |
mutate(r = runif(n())) %>% | |
arrange(r) %>% | |
head(N) | |
participants$p <- seq.int(nrow(participants)) | |
participants <- cbind(participants, tokens) %>% | |
select(p,condition,token) | |
participants %>% | |
group_by(condition) %>% | |
summarise(count = length(condition)) | |
write.csv(participants, file='data/participants.csv', row.names = FALSE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment