Last active
February 7, 2019 06:28
-
-
Save kosugitti/a732f7d07957517af7259af62c0211c8 to your computer and use it in GitHub Desktop.
群ごとの平均
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
A <- factor(rep(1:2,each=8),labels=LETTERS[1:2]) | |
B <- factor(rep(rep(1:4,each=2),2),labels=letters[1:4]) | |
C <- factor(rep(1:2,8),labels=c("あ","い")) | |
dat <- data.frame(A,B,C) | |
dat$val <- rnorm(16,0,1) | |
library(tidyverse) | |
dat %>% group_by(A,B) %>% summarise(means=mean(val)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment