我在R中使用ggplot2并且有颜色(variable1)和线型(variable2)的手动缩放.其中一个级别对于这两种类型都是相同的,我只希望它以简单的线条出现,因此从variable2图例中消失.
请参阅下面的最小代码
require(ggplot2)
data_0 <- expand.grid(x=1:2,
variable1=c("nothing", "A", "B"),
variable2=c("nothing", "positif", "negatif")
)
data <- subset(data_0, !((variable1=="nothing" & variable2 != "nothing") |
(variable2=="nothing" & variable1 != "nothing")))
data$y <- rep(1:5, each = 2)
ggplot(data=data, aes(x=x, y=y, colour = variable1, lty = variable2))+
geom_line(size=1.5)+
theme_bw()+
theme(legend.position="bottom")+
scale_linetype_manual(values = c(1,3,5))
Run Code Online (Sandbox Code Playgroud) 在excel表中,我从A1到A6:
1,2,4,6,8,9
我想,使用MATCH函数,检索包含5的最小间隔.这里,4和6.
我可以轻松使用MATCH和INDEX函数找到4,但我找不到找到6的方法.
如何在MATCH函数中反转数组的顺序?