Last active
December 5, 2024 19:41
-
-
Save efi/58c08f9a512eee98f28f1495d6848faa to your computer and use it in GitHub Desktop.
This file contains hidden or 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
rm(list=ls()) | |
options(digits=22) | |
g <- expand.grid(replicate(10, 0:1, simplify=F)) | |
m <- rowMeans(g) | |
unique(m) | |
df = data.frame() | |
for (j in 1:1024) { | |
for (i in 1:10) { | |
df = rbind(df,c(g[j,i],j)) | |
} | |
} | |
colnames(df) <- c("value","sample") | |
df | |
library(dplyr) | |
averages <- df %>% group_by(sample) %>% summarise(average_value = mean(value)) | |
unique(averages$average_value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment