我有如下图表。
test <- expand.grid('cat' = LETTERS[1:5], 'cond'= c(F,T), 'year' = 2001:2005)
test$value <- floor((rnorm(nrow(test)))*100)
test$value[test$value < 0] <- 0
ggplot() +
geom_bar(data=test, aes(y = value, x = year, fill = cat), stat="identity",position='dodge') +
theme_bw()
我需要将每个“ cat”除以“ cond”(真或假)。我应该怎么做?