可以按两列进行分组吗?所以画出了叉积
例如:
frame <- data.frame(
series <- rep(c('a', 'b'), 6),
sample <- rep(c('glass','water', 'metal'), 4),
data <- c(1:12))
ggplot(frame, aes()) # ...
使点6
和12
共享一个组,但不与3
共享.
可以按两列进行分组吗?所以画出了叉积
例如:
frame <- data.frame(
series <- rep(c('a', 'b'), 6),
sample <- rep(c('glass','water', 'metal'), 4),
data <- c(1:12))
ggplot(frame, aes()) # ...
使点6
和12
共享一个组,但不与3
共享.
为什么不把这两列放在一起,使用that个变量作为组呢?
frame$grp <- paste(frame[,1],frame[,2])
一种更正式的方法是使用函数interaction
.