ggplot2ã§è¤æ°ã®å åã«ããã°ã«ã¼ãã§æãç·ãããã
åå åãçµåããåã追å ããã°ããã£ã¡ãããã®ã ããggplot2ä¸ã§æå®ããæ¹æ³ããã£ãããªã¨æããªããæãåºããªãã£ã+ã°ã°ãã¥ããã£ãã®ã§ãããåå¿ã
interaction()ã使ãã
library(ggplot2) library(dplyr) # ChickWeightãã¼ã¿ã§ååã®ä½éã43以ä¸ãå¦ãã®ãã©ã°ãç«ã¦ã summarised_weight <- ChickWeight %>% group_by(Chick) %>% mutate(flag = weight[Time==0]>=43) %>% ungroup %>% group_by(Time, Diet, flag) %>% summarise(w_mean = mean(weight)) # Dietã¨flagãçµã¿ãããæãç·ãããããæã ggplot(summarised_weight, aes(Time, w_mean, color = interaction(Diet, flag, sep = "_"))) + geom_line()
ã§ãããå¥ã«paste()ã§ãåé¡ãªããªã
Â